This repository has been archived by the owner on Oct 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix category item that cannot handle itemMarker correctly
- Loading branch information
Showing
12 changed files
with
132 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
__tests__/integration/charts/legend/category-item-marker-2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { Group, Rect, Circle, Path } from '@antv/g'; | ||
import { colors, flowItemData } from './data'; | ||
import { Category } from './utils'; | ||
|
||
export const CategoryItemMarker2 = () => { | ||
const group = new Group({ | ||
style: { | ||
width: 750, | ||
height: 50, | ||
}, | ||
}); | ||
|
||
const paths: any = [ | ||
[['M', -10, 0], ['A', 10, 10, 0, 1, 0, 10, 0], ['A', 10, 10, 0, 1, 0, -10, 0], ['Z']], | ||
[['M', -6.18, 0], ['L', 0, -10], ['L', 6.18, 0], ['L', 0, 10], ['Z']], | ||
[ | ||
['M', 0, -10], | ||
['L', 8.660254037844386, -5], | ||
['L', 8.660254037844386, 5], | ||
['L', 0, 10], | ||
['L', -8.660254037844386, 5], | ||
['L', -8.660254037844386, -5], | ||
['Z'], | ||
], | ||
[['M', -10, -10], ['L', 10, -10], ['L', 10, 10], ['L', -10, 10], ['Z']], | ||
[['M', -10, -8.660254037844386], ['L', 10, -8.660254037844386], ['L', 0, 8.660254037844386], ['Z']], | ||
[['M', -10, 8.660254037844386], ['L', 0, -8.660254037844386], ['L', 10, 8.660254037844386], ['Z']], | ||
[['M', -10, -8.5], ['L', 10, 8.5], ['L', 10, -8.5], ['L', -10, 8.5], ['Z']], | ||
[['M', -10, 0], ['A', 10, 10, 0, 1, 0, 10, 0], ['A', 10, 10, 0, 1, 0, -10, 0], ['Z']], | ||
[ | ||
['M', -10, 0], | ||
['L', 10, 0], | ||
['M', 0, -10], | ||
['L', 0, 10], | ||
], | ||
[['M', -6.18, 0], ['L', 0, -10], ['L', 6.18, 0], ['L', 0, 10], ['Z']], | ||
[['M', -10, -10], ['L', 10, -10], ['L', 10, 10], ['L', -10, 10], ['Z']], | ||
[['M', -10, 8.660254037844386], ['L', 0, -8.660254037844386], ['L', 10, 8.660254037844386], ['Z']], | ||
[ | ||
['M', 0, -10], | ||
['L', 8.660254037844386, -5], | ||
['L', 8.660254037844386, 5], | ||
['L', 0, 10], | ||
['L', -8.660254037844386, 5], | ||
['L', -8.660254037844386, -5], | ||
['Z'], | ||
], | ||
[ | ||
['M', -10, -10], | ||
['L', 10, 10], | ||
['M', 10, -10], | ||
['L', -10, 10], | ||
], | ||
[['M', -10, -8.5], ['L', 10, 8.5], ['L', 10, -8.5], ['L', -10, 8.5], ['Z']], | ||
[ | ||
['M', -10, 0], | ||
['L', 10, 0], | ||
], | ||
[ | ||
['M', 0, 10], | ||
['L', 0, -10], | ||
], | ||
[ | ||
['M', -5, -10], | ||
['L', 5, -10], | ||
['M', 0, -10], | ||
['L', 0, 10], | ||
['M', -5, 10], | ||
['L', 5, 10], | ||
], | ||
[['M', -10, -8.660254037844386], ['L', 10, -8.660254037844386], ['L', 0, 8.660254037844386], ['Z']], | ||
]; | ||
|
||
group.appendChild( | ||
new Category({ | ||
style: { | ||
layout: 'grid', | ||
gridCol: 10, | ||
height: 40, | ||
data: paths.map((path: any, i: number) => ({ label: i, color: 'red' })), | ||
titleText: 'Legend Title', | ||
width: 500, | ||
itemMarker: (d: any, i: number) => () => | ||
new Path({ | ||
style: { | ||
path: paths[i], | ||
}, | ||
}), | ||
itemMarkerStroke: 'red', | ||
itemMarkerFill: (_: any, i: number) => colors[i % colors.length], | ||
itemValue: '', | ||
}, | ||
}) | ||
); | ||
|
||
return group; | ||
}; | ||
|
||
CategoryItemMarker2.tags = ['分类图例', '图标', '自定义']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { Layout } from './layout'; | ||
export type { LayoutOptions, LayoutStyleProps } from './layout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters