From ce500cf22a8413452e3d9da1dbe4df499bbf5dc2 Mon Sep 17 00:00:00 2001 From: huanxi Date: Mon, 29 Jul 2024 12:39:41 +0800 Subject: [PATCH] feature(treemap): add custom cursor properties for treemap (#20113) --- src/chart/treemap/TreemapSeries.ts | 4 +- src/chart/treemap/TreemapView.ts | 3 + test/treemap-cursor.html | 193 +++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 test/treemap-cursor.html diff --git a/src/chart/treemap/TreemapSeries.ts b/src/chart/treemap/TreemapSeries.ts index 571475e714..a38446ed85 100644 --- a/src/chart/treemap/TreemapSeries.ts +++ b/src/chart/treemap/TreemapSeries.ts @@ -144,7 +144,9 @@ export interface TreemapSeriesNodeItemOption extends TreemapSeriesVisualOption, color?: ColorString[] | 'none' - decal?: DecalObject[] | 'none' + decal?: DecalObject[] | 'none', + + cursor?: string } export interface TreemapSeriesOption diff --git a/src/chart/treemap/TreemapView.ts b/src/chart/treemap/TreemapView.ts index bc59c28544..a0b892e1ee 100644 --- a/src/chart/treemap/TreemapView.ts +++ b/src/chart/treemap/TreemapView.ts @@ -877,6 +877,9 @@ function renderNode( // Only for enabling highlight/downplay. data.setItemGraphicEl(thisNode.dataIndex, group); + const cursorStyle = nodeModel.getShallow('cursor'); + cursorStyle && content.attr('cursor', cursorStyle); + enableHoverFocus(group, focusOrIndices, blurScope); } diff --git a/test/treemap-cursor.html b/test/treemap-cursor.html new file mode 100644 index 0000000000..2a415d4ccb --- /dev/null +++ b/test/treemap-cursor.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + +
+
+ + + +