#2225·nvd3

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

Author: whyjay17Created Nov 25, 2020Updated Nov 25, 2020

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?