react-financial-charts icon indicating copy to clipboard operation
react-financial-charts copied to clipboard

Loading more data asynchrously without altering viewport

Open stam opened this issue 3 years ago • 3 comments

Hey! First of all thanks for this amazing library, my code became a bit cleaner again after switching from react-stockcharts. The usecase I'm trying to implement is when a user scrolls to the left, historic data is fetched, and this data is loaded without rescaling the xAxis.

I'm not sure if it's a feature request or just me not seeing how to achieve this. I made a codesandbox to show what I mean: https://codesandbox.io/s/financial-charts-add-data-fousq0?file=/src/App.tsx

In the example by default the chart shows 50 candles, but when scrolling back the state gets set to 100 candles, to emulate more data being fetched from an API. Now the entire chart redraws after more data is loaded, the xAxis is reset and the user loses his context.

How can I achieve this so the user doesn't lose his context?

stam avatar Mar 28 '22 20:03 stam

I'm not the developer, but I think the you want to use one of the ZoomAnchor classes. I believe the default one is lastVisibleItemBasedZoomAnchor, which might be causing your issue.

chrism2671 avatar Sep 14 '22 12:09 chrism2671

@stam I think this is what u looking for: https://github.com/react-financial/react-financial-charts/discussions/504

GitHub
Hello, I'm so happy to find this library, just thank you! Already implemented quite a few things and upgrades. But I need help with initial view area. Lets say I have 2 time values start and en...

OnlyC avatar Nov 09 '22 05:11 OnlyC

@stam hey, do you manage to achieve this?

kaijaz123 avatar Mar 23 '24 00:03 kaijaz123