Attach metadata to data point
Hi,
Bit new to uPlot. I am using a react version of uPlot, and I am wondering what is the best way to display additional metadata to my data point on hover with cursor?
To be more specific, we already display a value for every series on hover over the data point, but can we render additional meta data for that point as well?
sure, you can use series.values option to return an object of properties to display in a table-style legend.
examples:
https://leeoniya.github.io/uPlot/demos/scatter.html https://github.com/leeoniya/uPlot/blob/f98d1d34d92a128f18fbaac9293910eed85ea19c/demos/scatter.html#L416-L435
https://leeoniya.github.io/uPlot/demos/time-periods.html https://github.com/leeoniya/uPlot/blob/f98d1d34d92a128f18fbaac9293910eed85ea19c/demos/time-periods.html#L128-L139
you can hold these values as additional data arrays that are not defined in the options.series array, and access them from there.
Thank you for that. The data arrays idea is exactly what I had in mind too. Thank you for confirming it.