Skip to content

Commit 5bdb88a

Browse files
committed
feat: add hyphenPoint symbol
1 parent 2f5571d commit 5bdb88a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

@sensoro-design/plots/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { register } from '@antv/g2';
22
import { Dark } from './theme/dark';
33
import { Light } from './theme/light';
4+
import { hyphenPoint } from './symbol/hyphenPoint';
45

56
register('theme.dark', Dark);
67
register('theme.light', Light);
78

9+
register('symbol.hyphenPoint', hyphenPoint);
10+
811
export { Dark, Light };
912
export * from './components';
1013
export * from './config/colors';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { SymbolFactor } from '@antv/g2';
2+
3+
export const hyphenPoint = Object.assign<SymbolFactor, Partial<SymbolFactor>>(
4+
(x, y, r) => {
5+
const segment = r / 10;
6+
const radius1 = segment * 1.25;
7+
8+
return [
9+
['M', segment * 3.75, -segment * 1.25],
10+
['L', -segment * 3.75, -segment * 1.25],
11+
['A', radius1, radius1, 0, 0, 0, -segment * 3.75, segment * 1.25],
12+
['L', segment * 3.75, segment * 1.25],
13+
['A', radius1, radius1, 0, 0, 0, segment * 3.75, -segment * 1.25],
14+
['Z'],
15+
];
16+
},
17+
{
18+
style: ['fill'],
19+
},
20+
);

packages/storybook/stories/Charts/Line.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function Middle() {
4242
colorField: 'category',
4343
legend: {
4444
color: {
45-
itemMarker: 'hyphen',
45+
itemMarker: 'hyphenPoint',
4646
layout: {
4747
justifyContent: 'flex-end',
4848
},

0 commit comments

Comments
 (0)