Skip to content

Commit

Permalink
refactor: legend support string itemMarker
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Mar 25, 2024
1 parent 006ddd1 commit 773da82
Show file tree
Hide file tree
Showing 18 changed files with 343 additions and 23 deletions.
29 changes: 29 additions & 0 deletions __tests__/integration/components/legend/category-marker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Group } from '@antv/g';
import { Category, createItemData } from './utils';
import { colors } from './data';

export const CategoryMarker = () => {
const group = new Group();

const g1 = group.appendChild(new Group());

g1.appendChild(
new Category({
style: {
data: createItemData(1),
layout: 'grid',
titleText: 'Legend Title',
width: 455,
height: 50,
gridCol: 4,
gridRow: 1,
itemMarker: 'square',
click: () => console.log('click'),
itemMarkerFill: (_: any, i: number) => colors[i % colors.length],
},
})
);
return group;
};

CategoryMarker.tags = ['分类图例', '图例位置', '无偏移'];
1 change: 1 addition & 0 deletions __tests__/integration/components/legend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export { CategoryLayout31 } from './category-layout-31';
export { CategoryLayout32 } from './category-layout-32';
export { CategoryLayout33 } from './category-layout-33';
export { CategoryLayout34 } from './category-layout-34';
export { CategoryMarker } from './category-marker';
export { CategoryPosition1 } from './category-position-1';
export { CategoryPosition2 } from './category-position-2';
export { CategoryPosition3 } from './category-position-3';
Expand Down
1 change: 1 addition & 0 deletions __tests__/integration/components/marker/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './marker-1';
export * from './marker-update';
23 changes: 23 additions & 0 deletions __tests__/integration/components/marker/marker-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Group } from '@antv/g';
import { Marker } from '../../../../src';

export const MarkerUpdate = () => {
const group = new Group();

const marker = group.appendChild(
new Marker({
style: {
x: 50,
y: 50,
symbol: 'circle',
size: 16,
stroke: 'blue',
lineWidth: 2,
},
})
);

marker.update({ symbol: 'square' });

return group;
};
227 changes: 227 additions & 0 deletions __tests__/integration/snapshots/CategoryMarker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions __tests__/integration/snapshots/CategoryPosition1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __tests__/integration/snapshots/CrosshairCircle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __tests__/integration/snapshots/CrosshairLine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __tests__/integration/snapshots/CrosshairPolygon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions __tests__/integration/snapshots/HandleDemo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions __tests__/integration/snapshots/MarkerUpdate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 773da82

Please sign in to comment.