leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.51k stars 371 forks source link

Legend: only show X and focused serie #884

Closed pvictor closed 6 months ago

pvictor commented 6 months ago

Hello,

Is it possible to only show legend for X value and the focused serie ? Something similar to this https://leeoniya.github.io/uPlot/demos/focus-cursor.html but instead of modifying opacity hide the entry in legend.

thanks !

leeoniya commented 6 months ago

should be possible by using the setSeries hook and using the callback to update the legend items' DOM with display: none.