leeoniya / uPlot

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

Points and paths are separated when changing scale width #905

Closed dadebue closed 4 months ago

dadebue commented 4 months ago

Following up on #902 I've tested a bit and everything except one thing seems quite right! Nice :)

The thing I found is the following:

https://github.com/leeoniya/uPlot/assets/81422785/d609b50b-933f-4f99-bc43-f8d61e275457

The paths of all other series are not redrawn (correctly) when the scaling is used together with the axis size option (to minimize the axis space). In the example the axis size changes and only the path of the series on the changed scale are redrawn correctly. For all other series the datapoints are redrawn correctly, but the paths are still in the old position. Therefore the points and path do not match anymore...

Here is the updated fiddle (with the specified commit if I've done it correctly): https://jsfiddle.net/xvotLbn1/3/

leeoniya commented 4 months ago

great catch! this bug probably would have slipped into the next release :grimacing:

also updated demo to include the Shift + Drag scale grow/contract behavior as well as the axis size re-calc:

https://github.com/leeoniya/uPlot/blob/master/demos/y-scale-drag.html

dadebue commented 4 months ago

Always glad if I can help this awesome library :)