should `i` be relative to the internal flattened array?
See original GitHub issueright now the public API is split into x
and y
sections, but internally they’re merged to keep the loops uniform, with just a sprinkling of if (i ==0)
branching to split off x
.
the public API accepts i
that is against the internal flattened array, but this is not terribly intuitive, especially since uPlot goes to additional lengths to make it look like the internals match the externals, e.g.
https://github.com/leeoniya/uPlot/blob/589d1dd2a17d7fdc33aef176b837678131b460c2/src/Line.js#L174
this can probably be improved.
i’ve considered dropping the x/y and simply making the lists flat but it results in awkwardness elsewhere. e.g. x
is required, but if nothing needs to be customized for the x axis, you need to provide options that start with null: axes: [null, {values}]
. also, there can be multiple x axes (let’s say different units), then what?
i guess one route can be to attach an extra required property to each option item in a flat list, eg. dir: 'x'
, but that’s not great either.
considerations:
- data[0] is always the x-series data and there can only be a single x series
- there could be multiple x axes (alt units)
if we simply disallow multiple x axes, then this whole situation becomes easier. we can use flat lists and simply say that data[0], series[0] and axes[0] are all x
, everything else is y
, and then we just use a flat i
as we do now and everything becomes logically aligned. yes, there will be axes: [null, {}, {}]
but it’s easy to reason about.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
chart 2: https://leeoniya.github.io/uPlot/demos/time-periods.html
multiple x-axes like image. I want to render a time-series chart with 2 lines. But they have different x.