This question is locked. New answers and comments are not allowed.
I want to display a single candlestick. My XAML & C# code are given below:
My XAML:
<telerikChart:RadCartesianChart x:Name="rccPerformanceOHLC" Palette="Warm" Margin="20,0,0,0" EmptyContent="" MinWidth="30"> <telerikChart:RadCartesianChart.Behaviors> <telerikChart:ChartPanAndZoomBehavior HandleDoubleTap="False" PanMode="None" ZoomMode="None" /> </telerikChart:RadCartesianChart.Behaviors> <telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:LinearAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="0" Maximum="34.7725" Minimum="34.36" Visibility="Collapsed" /> </telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:CategoricalAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="0" Visibility="Collapsed" /> </telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:CandlestickSeries> <telerikCharting:OhlcDataPoint Category="Mon" Open="34.48" High="34.69" Low="34.47" Close="34.63"/> </telerikChart:CandlestickSeries></telerikChart:RadCartesianChart>My C# code:
private void DisplayOhlcValue(DateTime dtTime, float fOpen, float fHigh, float fLow, float fClose){ // Plot the candlelight CandlestickSeries ohlcSeries = (CandlestickSeries)rccPerformanceOHLC.Series[0]; float min = fLow - ((fHigh - fLow) / 2f); float max = min + ((fHigh - min) / 0.8f); ((LinearAxis)rccPerformanceOHLC.VerticalAxis).Maximum = max; ((LinearAxis)rccPerformanceOHLC.VerticalAxis).Minimum = min; // 1. Code that clears the existing data point and adds a new one //ohlcSeries.DataPoints.Clear(); //ohlcSeries.DataPoints.Add(new OhlcDataPoint()); //ohlcSeries.DataPoints[0].Category = ""; //ohlcSeries.DataPoints[0].Open = fOpen; //ohlcSeries.DataPoints[0].High = fHigh; //ohlcSeries.DataPoints[0].Low = fLow; //ohlcSeries.DataPoints[0].Close = fClose; // 2. Code that changes OHLC values in the existing data point //((OhlcDataPoint)ohlcSeries.DataPoints[0]).Category = ""; //((OhlcDataPoint)ohlcSeries.DataPoints[0]).Open = fOpen; //((OhlcDataPoint)ohlcSeries.DataPoints[0]).High = fHigh; //((OhlcDataPoint)ohlcSeries.DataPoints[0]).Low = fLow; //((OhlcDataPoint)ohlcSeries.DataPoints[0]).Close = fClose;}I tried two ways to set OHLC values, as seen in the code. But I get an Index out of range error for both. What am I doing wrong?