You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/02/22 07:57:23 UTC

[GitHub] [echarts] zhixuan-loh commented on issue #8694: How to highlight selected data point.

zhixuan-loh commented on issue #8694:
URL: https://github.com/apache/echarts/issues/8694#issuecomment-1047517993


   > In my case to get the effect above, I'm using **itemStyle.opacity** I'm storing local "state" on each series point to know if it's selected. Then applying the style based on the "selected" state.
   > 
   > So more or less:
   > 
   > ```
   > var series = this.chartOption.series;
   > var clickSeries = series[event.seriesIndex].data;
   > var entry = clickSeries[ev.dataIndex];
   > entry.clicked = !entry.clicked;
   > var any = clickSeries.filter(d => d.clicked).length !== 0;
   > series.map(d => d.itemStyle.opcacity = !any || d.clicked ? 1: 0.3);
   > echart.setOption({series});
   > ```
   > 
   > So instead hightlight you lowlight others :)
   
   Thank you for the workaround. I'm new to Echarts and I tried to implement this feature using their options API and I couldn't get it to work even though I strongly believe this is a commonly needed feature. I tried your workarouhnd and it worked. But I was thinking Echarts should be able to provide this feature since it worked for similar charts like bar chart. Does anyone here have any solution to this [issue](https://github.com/apache/echarts/issues/16545)?


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org