SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

Is there an convenient way to convert an existing IXyDataSeries<Date, Double> to IOhlcDataSeries<Date, Double> ?
How do Scichart collapse Candlesticks (and presumably merging with neighbouring candlesticks) when its very zoomed out e.g. 1 year period

Version
1.2.0
  • You must to post comments
1
0

Hello there,

XyDataSeries contains only X,Y values whereas OhlcDataSeries contains Open, High, Low, Close, Date values. It’s not possible to convert from XyDataSeries to OhlcDataSeries because you would need to provide the extra data (The Open, High, Low, Close). You could however use this API to copy the X,Y values from XyDataSeries into a new OhlcDataSeries:

   ohlcDataSeries.Append(openValues, highValues, lowValues, xyDataSeries.getYValues(), xyDataSeries.getXValues());

You would need to provide openValues, highValues and lowValues.

Next, is it possible to merge candles as you zoom? No it is not, as this would lose data, SciChart cannot do this. It has to draw the data you give it correctly.

You can however, change the FastCandlestickRenderableSeries.DataSeries for a new OhlcDataSeries with new data where you have merged the candles yourself.

You can also listen to Axis VisibleRange Changes to make changes to data dynaimcally as you zoom. For isntructions, please see the Axis Ranging – AutoRange and VisibleRange documentation and scroll down to ‘How to listen to VisibleRange changes

How to listen to VisibleRange changes

It is possible to subscribe to listening to the VisibleRange changes using a VisibleRangeChangeListener:

IAxis axis = new NumericAxis(getActivity());
axis.setVisibleRangeChangeListener(new IAxisCore.VisibleRangeChangeListener() {
    @Override
    public void onVisibleRangeChanged(IAxisCore axis, IRange oldRange, IRange newRange, boolean isAnimating) {
        // TODO change the OHLC data to merge candles as you zoom here 
    }
});

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.