This question is locked. New answers and comments are not allowed.
Hi,
I developed a Windows Phone 8 application: "Take A Hike" where one of the features is to track the user movement.
I created a RadCartesianChart with two series of DataPoints: Distance(X) vs. Elevation(Y) and Distance(X) vs. Speed(Y).
I would like to limit the series size to fixed amount of points, i.e. 300 points.
Aa data is being collected, I would like to draw all points if the total number of points is less than 300 or if the number of points is 300 to remove the first point and add the last point.
The chart is defined like this:
The code to add the points is done like this:
Can I remove the first points from the series and add the new points?
Will the chart update itself as I remove and add the new points?
I am trying to save time loading all the points (300) to the chart as I get a new points.
Thanks
Eitan
I developed a Windows Phone 8 application: "Take A Hike" where one of the features is to track the user movement.
I created a RadCartesianChart with two series of DataPoints: Distance(X) vs. Elevation(Y) and Distance(X) vs. Speed(Y).
I would like to limit the series size to fixed amount of points, i.e. 300 points.
Aa data is being collected, I would like to draw all points if the total number of points is less than 300 or if the number of points is 300 to remove the first point and add the last point.
The chart is defined like this:
<telerikChart:RadCartesianChart x:Name="TrackByDistanceChart" Grid.Row="2" Background="Bisque" Height="200" Margin="0,0,0,6"> <!--Zoom and Pan--> <telerikChart:RadCartesianChart.Behaviors> <telerikChart:ChartPanAndZoomBehavior ZoomMode="Horizontal" PanMode="Horizontal" /> </telerikChart:RadCartesianChart.Behaviors> <!--Horizontal Axis--> <telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:LinearAxis HorizontalAlignment="Center" LabelFitMode="Rotate" LabelRotationAngle="315" Style="{StaticResource LinearAxisStyle}" /> </telerikChart:RadCartesianChart.HorizontalAxis> <!--Verical Axis--> <telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:LinearAxis VerticalAlignment="Center" Style="{StaticResource LinearAxisStyle}" /> </telerikChart:RadCartesianChart.VerticalAxis> <!--Grid--> <telerikChart:RadCartesianChart.Grid> <telerikChart:CartesianChartGrid MajorLinesVisibility="XY" MajorXLinesRenderMode="All" Style="{StaticResource GridStyleDashedAll}"> <telerikChart:CartesianChartGrid.MajorXLineStyle> <Style TargetType="Line"> <Setter Property="Stroke" Value="{StaticResource SolidBlackBrush}" /> </Style> </telerikChart:CartesianChartGrid.MajorXLineStyle> <telerikChart:CartesianChartGrid.MajorYLineStyle> <Style TargetType="Line"> <Setter Property="Stroke" Value="{StaticResource SolidBlackBrush}" /> </Style> </telerikChart:CartesianChartGrid.MajorYLineStyle> </telerikChart:CartesianChartGrid> </telerikChart:RadCartesianChart.Grid> <!--Scatter Line--> <telerikChart:ScatterLineSeries Stroke="Red" StrokeThickness="2" ClipToPlotArea="False"> </telerikChart:ScatterLineSeries> <telerikChart:ScatterLineSeries Stroke="Blue" StrokeThickness="2" ClipToPlotArea="False"> <telerikChart:ScatterLineSeries.VerticalAxis> <telerikChart:LinearAxis HorizontalLocation="Right" VerticalAlignment="Center" Style="{StaticResource LinearAxisStyle}" /> </telerikChart:ScatterLineSeries.VerticalAxis> </telerikChart:ScatterLineSeries></telerikChart:RadCartesianChart>The code to add the points is done like this:
trackByDistanceChartSeries0.DataPoints.Add( new ScatterDataPoint { XValue = Distance, YValue = Elevation} );trackByDistanceChartSeries1.DataPoints.Add( new ScatterDataPoint { XValue = Distance, YValue = Speed } );Can I remove the first points from the series and add the new points?
trackByDistanceChartSeries0.DataPoints.RemoveAt( 0 );trackByDistanceChartSeries1.DataPoints.RemoveAt( 0 );trackByDistanceChartSeries0.DataPoints.Add( new ScatterDataPoint { XValue = Distance, YValue = Elevation } );trackByDistanceChartSeries1.DataPoints.Add( new ScatterDataPoint { XValue = Distance, YValue = Speed } );Will the chart update itself as I remove and add the new points?
I am trying to save time loading all the points (300) to the chart as I get a new points.
Thanks
Eitan