leeoniya / uPlot

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

add new "justify" scale type #928

Open leeoniya opened 2 months ago

leeoniya commented 2 months ago

there are several viz types that can benefit from a built-in scale that is ordinal with respect to the number of datapoints and/or number of visible series.

grouped bars demo does its own scale math internally to distribute the bars correctly. it does a 2-level distribution -- first groups are spread based on number of datapoints and then then bars within those groups are spread based on number of series. this is done along x axis: https://leeoniya.github.io/uPlot/demos/multi-bars.html

state timeline and status history distribute lanes along y axis based on number of series. the y "values" represent the color, so it's pretty weird: https://leeoniya.github.io/uPlot/demos/timeline-discrete.html

it's time to internalize at least the scale math properly. dealing with these bits externally is a huge headache.

this is a significant undertaking that will likely touch 70% of the codebase. with many unknowns still...