mattseaton
Posts: 1
Joined: Sat Dec 24, 2022 2:02 pm

Resampling events in StockChart?

Here is my situation. I would appreciate any help or guidance

I have a web page that displays a standard candlestick chart. I want to do some data processing on the data after loading. For example say I want to add a RSI to the chart. Easy enough.

As I zoom the chart out on the time axis, at a certain threshold the daily data will automatically resample to become weekly data, and eventually monthly, etc..

When the data resamples to become weekly, the RSI line just becomes a smoothed out version of daily RSI. I want to recompute everything as a true weekly RSI. How can I do this?

1. Are any events fired when this resampling occurs? I don't see anything in the docs.
2. Can I get the newly rendered WEEKLY data out of the chart? I can use chart.series[0].points, but this only shows the rendered points, not the full dataset. Is there a way to get the full WEEKLY data out? chart.series[0].xData still shows daily data.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Resampling events in StockChart?

Hello and welcome to our forum!
1. Are any events fired when this resampling occurs? I don't see anything in the docs.
If you get data from a CSV file, you can use data.beforeParse or data.parsed to modify them before generating them.
https://api.highcharts.com/highcharts/data.beforeParse
https://api.highcharts.com/highcharts/data.parsed

If you want to modify the data after zooming, you can use the afterSetExtremes() callback function.
https://api.highcharts.com/highcharts/x ... etExtremes
2. Can I get the newly rendered WEEKLY data out of the chart? I can use chart.series[0].points, but this only shows the rendered points, not the full dataset. Is there a way to get the full WEEKLY data out? chart.series[0].xData still shows daily data.
Yes, chart.series[0].points returns only visible points, to list all data you have to use chart.series[0].data.

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Stock”