Ovilia commented on code in PR #21481:
URL: https://github.com/apache/echarts/pull/21481#discussion_r2787336295
##########
src/model/Series.ts:
##########
@@ -67,9 +67,10 @@ const inner = modelUtil.makeInner<{
}, SeriesModel>();
function getSelectionKey(data: SeriesData, dataIndex: number): string {
- return data.getName(dataIndex) || data.getId(dataIndex);
+ return data.getId(dataIndex);
Review Comment:
I'm afraid this fixing is not correct. In ECharts, series/items with the
same `name` are intentionally considered as the same.
##########
test/treemap-select-21480.html:
##########
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>treemap select 21480</title>
+ <style>
+ html, body, #main { width: 100%; height: 100%; margin: 0; }
+ </style>
+</head>
+<body>
+ <div id="main"></div>
+ <script src="../dist/echarts.js"></script>
+ <script>
+ const chart = echarts.init(document.getElementById('main'));
+ chart.setOption({
+ series: [{
+ type: 'treemap',
+ selectedMode: 'single',
+ roam: false,
+ nodeClick: false,
+ select: { itemStyle: { borderWidth: 4 } },
+ data: [
+ { name: 'same', value: 10 },
+ { name: 'same', value: 20 },
+ { name: 'same', value: 30 },
+ { name: 'same', value: 40 }
+ ]
+ }]
+ });
+
+ chart.dispatchAction({
+ type: 'select',
+ seriesIndex: 0,
+ dataIndex: 3
+ });
+ console.log('selectedMap:', chart.getOption().series[0].selectedMap);
+ console.log('selectedIndices:',
chart.getModel().getSeriesByIndex(0).getSelectedDataIndices());
Review Comment:
The expected result of this example should be all those four data being
selected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]