lightweight-charts icon indicating copy to clipboard operation
lightweight-charts copied to clipboard

Pop time series data

Open tpunt opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

I have implemented bar replay mode in my personal app. This is for things such as analysing price data as well as looking back at my past trades. Today, I don't believe there is a nice way to revert the latest bar(s). I have to perform a setData() operation on the time series, which resets the axes. This is the biggest pain point in the UX, since you often do not want the candles to be snapped back the right-hand side of the chart (especially with line titles enabled).

I have created a PoC here: https://github.com/tpunt/lightweight-charts/tree/bar-pop

Describe the solution you'd like

I'd like to be able to simply remove bars from the end of the time series. This will provide a smooth UX when in replay mode.

Additional context

This is a demo of what I mean:

https://github.com/tradingview/lightweight-charts/assets/1403064/f039d4b1-0a3b-448c-94f0-948ff8d5a04f

tpunt avatar Feb 13 '24 09:02 tpunt

I've managed to update my private fork to the latest version and integrate the time series popping ability. The above now looks like the following:

https://github.com/tradingview/lightweight-charts/assets/1403064/40fb4cc6-73d0-4fcc-a505-816fb803f539

It is almost exactly what I want. When popping a candlestick, the chart does jump 1 bar to the right still, but this is good enough for now.

I hope this better demonstrates the usefulness of this feature.

tpunt avatar Feb 18 '24 15:02 tpunt

Thanks @tpunt, we will have a more detailed look into this during our work for the next major release of the library.

SlicedSilver avatar May 08 '24 10:05 SlicedSilver