This question is locked. New answers and comments are not allowed.
Hello,
I have a small problem and I would appreciate it if someone can help me with that.
I have the following chart:
Currently it displays 10 bars on the page. What I want to do is add more bars at specific intervals (eg. add another 1 every one minute) without resizing the bars. Also, the chart must be automatically panned to the last item inserted. I mean that I want the bars to always be the same width. I have also added the behavior ChartPanAndZoomBehavior so that when bars are out of screen the user can pan it, but with no luck. Currently my C# code for this is very small:
I think that I might have to do some trick with the chart.zoom, but I do not know how I can calculate the correct zooming factor.
Thank you very much.
Efthymios Kalyviotis
Computer Programmer
I have a small problem and I would appreciate it if someone can help me with that.
I have the following chart:
<telerikChart:RadCartesianChart x:Name="chart" Margin="0 0" Height="170"> <telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:CategoricalAxis LabelOffset="4" LabelInterval="5" /> </telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:LinearAxis/> </telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:RadCartesianChart.Behaviors> <telerikChart:ChartPanAndZoomBehavior ZoomMode="Horizontal" PanMode="Horizontal" HandleDoubleTap="False"/> <telerikChart:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="True"/> </telerikChart:RadCartesianChart.Behaviors> <telerikChart:BarSeries x:Name="barSeries" Foreground="#00FF0000"> <telerikCharting:CategoricalDataPoint Value="1" Label="2"/> <telerikCharting:CategoricalDataPoint Value="21" Label="2"/> <telerikCharting:CategoricalDataPoint Value="5" Label="2"/> <telerikCharting:CategoricalDataPoint Value="3" Label="2"/> <telerikCharting:CategoricalDataPoint Value="1" Label="2"/> <telerikCharting:CategoricalDataPoint Value="9" Label="2"/> <telerikCharting:CategoricalDataPoint Value="1" Label="2"/> <telerikCharting:CategoricalDataPoint Value="11" Label="2"/> <telerikCharting:CategoricalDataPoint Value="10" Label="2"/> <telerikCharting:CategoricalDataPoint Value="17" Label="2"/> </telerikChart:BarSeries></telerikChart:RadCartesianChart>Currently it displays 10 bars on the page. What I want to do is add more bars at specific intervals (eg. add another 1 every one minute) without resizing the bars. Also, the chart must be automatically panned to the last item inserted. I mean that I want the bars to always be the same width. I have also added the behavior ChartPanAndZoomBehavior so that when bars are out of screen the user can pan it, but with no luck. Currently my C# code for this is very small:
ObservableCollection<double> chartValues = new ObservableCollection<double>(); Random rnd = new Random(); private void startLocationButton2_Click(object sender, RoutedEventArgs e) {// Debug.WriteLine(this.chart.PanOffset.X); this.chart.Series[0].ItemsSource = chartValues; chartValues.Add(rnd.NextDouble() * 300);// this.chart.Zoom = new Size(chartValues.Count / 10, 1); }I think that I might have to do some trick with the chart.zoom, but I do not know how I can calculate the correct zooming factor.
Thank you very much.
Efthymios Kalyviotis
Computer Programmer