leeoniya / uPlot

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

Setting Legend Markers using Paths #941

Open febkor opened 3 weeks ago

febkor commented 3 weeks ago

Thanks for the great library :)

I'm currently using uPlot to draw plots with custom markers, e.g. triangles, squares, stars etc, like done in this demo. It would be useful for users to see these markers in the legend.

If I'm not missing something, it seems the current uPlot api does not allow setting a canvas Path in the legend and relies primarily on CSS for styling the legend markers.

Would it be possible to add something like this to the API?

Alternatives I'm aware of:

These options all seem like (possibly hacky) workarounds. Are there any other reasonable options?

leeoniya commented 5 days ago

i think you've listed all the options :)

option 1 is probably not very good if all you need it to customize markers.

there's an issue open for this, but it's kinda backlogged: https://github.com/leeoniya/uPlot/issues/431