Pre loader

Converting IXyDataSeries to IOhlcDataSeries

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


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

  • You must to post comments

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() {
    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,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.