This is an automated email from the ASF dual-hosted git repository.

susiwen8 pushed a commit to branch codex/issue-21433-treemap-hover-clean
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit e3164808d2161cdd518a56f938ec06c31ccab3bb
Author: susiwen8 <[email protected]>
AuthorDate: Thu Apr 9 00:05:13 2026 +0800

    fix(treemap): keep parent select fill with upper label
---
 src/chart/treemap/TreemapView.ts    |  7 +++-
 test/ut/spec/series/treemap.test.ts | 69 +++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/src/chart/treemap/TreemapView.ts b/src/chart/treemap/TreemapView.ts
index 36a5918cd..4cb806559 100644
--- a/src/chart/treemap/TreemapView.ts
+++ b/src/chart/treemap/TreemapView.ts
@@ -923,7 +923,12 @@ function renderNode(
             const blurStyle = getStateItemStyle(itemStyleBlurModel);
             blurStyle.fill = itemStyleBlurModel.get('borderColor');
             const selectStyle = getStateItemStyle(itemStyleSelectModel);
-            selectStyle.fill = itemStyleSelectModel.get('borderColor');
+            const selectFill = itemStyleSelectModel.get('color');
+            selectStyle.fill = selectFill != null
+                ? selectFill
+                : itemStyleSelectModel.get('borderColor') != null
+                    ? itemStyleSelectModel.get('borderColor')
+                    : visualBorderColor;
 
             if (useUpperLabel) {
                 const upperLabelWidth = thisWidth - 2 * borderWidth;
diff --git a/test/ut/spec/series/treemap.test.ts 
b/test/ut/spec/series/treemap.test.ts
new file mode 100644
index 000000000..dc072b403
--- /dev/null
+++ b/test/ut/spec/series/treemap.test.ts
@@ -0,0 +1,69 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+import { EChartsType } from '@/src/echarts';
+import { createChart, getECModel } from '../../core/utHelper';
+
+describe('treemap', function () {
+
+    let chart: EChartsType;
+
+    beforeEach(function () {
+        chart = createChart();
+    });
+
+    afterEach(function () {
+        chart.dispose();
+    });
+
+    it('should use select.itemStyle.color for parent nodes with upperLabel', 
function () {
+        chart.setOption({
+            series: [{
+                type: 'treemap',
+                selectedMode: 'single',
+                upperLabel: {
+                    show: true,
+                    height: 24
+                },
+                select: {
+                    itemStyle: {
+                        color: '#ff0',
+                        borderColor: '#0f0'
+                    }
+                },
+                data: [{
+                    name: 'Bob',
+                    value: 10,
+                    children: [{
+                        name: 'Bob 1',
+                        value: 4
+                    }, {
+                        name: 'Bob 2',
+                        value: 6
+                    }]
+                }]
+            }]
+        });
+
+        const seriesModel = getECModel(chart).getSeriesByIndex(0);
+        const bg = seriesModel.getData().getItemGraphicEl(0) as any;
+
+        expect(bg.states.select.style.fill).toBe('#ff0');
+    });
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to