question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to highlight selected data point.

See original GitHub issue

One-line summary [问题简述]

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

You guys are doing fabulous work, I really appreciate your work in the field of charting library. Please help me in following problem, When user click on any data point on chart then I want to highlight that particular data point, like shown in following image. bar

I have achieve above effect using “brush” but I want to do this for all chart supported by echart. I have gone through visual-map, highlight action. Please suggest me the way to do this.

ECharts option [ECharts配置项]

option = {

}

Other comments [其他信息]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
gbriancommented, Aug 16, 2019

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 😃

0reactions
zhixuan-lohcommented, Feb 22, 2022

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to find, highlight and label a data point in Excel scatter plot
Click on the highlighted data point to select it. Click the Chart Elements button. Select the Data Labels box and choose where to...
Read more >
Highlight Data Points in Excel with a Click of a Button
Get the data in place. · Select the entire data, go to Insert –> Charts –> Line with Markers. · Go to Insert...
Read more >
Dynamic highlight data point on Excel chart - ExtendOffice
Dynamic highlight data point on Excel chart · 1. Select the data range and click Insert > Insert Line Or Area Chart >...
Read more >
How to Find, Highlight, and Label a Data Point in Excel Scatter ...
Simply hover on the data points in the scatter chart. · To highlight the data points for more information we can use data...
Read more >
How to highlight data points in an Excel chart using Form ...
How to highlight data points in an Excel chart using Form Controls · Make the following changes to the line and marker: Fill...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found