leeoniya / uPlot

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

[Question] Add current or last value in the Legend #992

Closed henjoe closed 3 months ago

henjoe commented 3 months ago

When I hover the mouse of my trend, it has already a tooltip showing values for that specific timeline:

image

But the legend (at the bottom) also shows the same information of my tooltip. What I want is it shows the latest or current value of my Trend instead of the hover (mouse) value.

Is it possible?

Regards,

leeoniya commented 3 months ago

you can supply a series.value callback that will render whatever you want in the legend.

the bubble demo uses this to show some arbitrary metric when nothing is hovered. it uses series.values, which is the table version of series.value.

https://leeoniya.github.io/uPlot/demos/scatter.html