novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

Is it possible to select a single line in a nv.models.lineChart()? #2225

Open whyjay17 opened 3 years ago

whyjay17 commented 3 years ago

I am trying to make an onClick event using dispatch.on('elementClick' on chart.lines where chart is nv.models.lineChart() What I did was

chart.lines.dispatch.on('elementClick', (e) => {
   console.log(e)
})

With this, when I clicked on a single line on a line chart that has multiple series (legends), it returns the information of all lines instead of the selected one. Is there a way to make this work only for the line that I selected?