leeoniya / uPlot

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

How can I know when the chart is finish drawing? #865

Closed Fadi-Aldalati closed 7 months ago

Fadi-Aldalati commented 9 months ago

Is there a way to know when the chart is finish drawing even if it's a work around ?

leeoniya commented 9 months ago

there's a ready hook that fires once everything is drawn after init. is that what you're looking for?

Fadi-Aldalati commented 9 months ago

Yes please, is there an example or something? Thank you very much

leeoniya commented 9 months ago

https://github.com/leeoniya/uPlot/blob/e8a1e8d6b70ca72f6e70d1f14894bc4a98cb47f2/demos/log-scales2.html#L234-L245

Fadi-Aldalati commented 9 months ago

When I'm doing this hooks: { ready: [ (u) => { console.log('Test'); }, ], } It's logging 3 times ,on the first 2 the chart's not finished but on the third it is , is this the expected behavior ?

leeoniya commented 9 months ago

is this the expected behavior ?

no, it should only fire once, like it does here: https://jsfiddle.net/ysnL60e1/

can you make a jsfiddle that shows the the behavior you're seeing?