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
- abc def asked 8 years ago
- You must login 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() {
@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
- Andrew Burnett-Thompson answered 8 years ago
- You must login to post comments
Please login first to submit.