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


How do I extract the latest OHLC datapoint from renderableSeries.DataSeries?

I need to extract all open, high, low & close values for the last candlestick in the chart. It is a real-time chart, so values are changing constantly.

  • You must to post comments

Hi there,

something like this:

var ohlcDataSeries = renderableSeries.DataSeries as OhlcDataSeries<DateTime, double>;
int count = ohlcDataSeries.Count;
DateTime date = ohlcDataSeries.XValues[count - 1];
double open = ohlcDataSeries.OpenValues[count - 1];
double high = ohlcDataSeries.HighValues[count - 1];
double low = ohlcDataSeries.LowValues[count - 1];
double close = ohlcDataSeries.CloseValues[count - 1]; // Note: CloseValues == YValues

That should do it!

If you want to be notified when data changes, you can subscribe to the SciChartSurface.Rendered event, or just get this value out when the data is appended.

Are you trying to create a latest price indicator on the axis? If so see the answer to your other post… đŸ™‚

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.