This is a migrated thread and some comments may be shown as answers.

Too much time to plot a series

1 Answer 55 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Angshuman
Top achievements
Rank 2
Angshuman asked on 19 Nov 2010, 12:51 PM
I am plotting a line graph with a set of test data of only 5 data points and it takes visibly long time to plot the line. Is it some kind of animated behavior that is responsible for this or I am missing something? Please help me on how I can get the line plotted in just one shot - with no visible delay between its start and end ...

The code is as follws:

The data structure that is set to the itemsource of  RadChart control is

private ObservableCollection<KeyValuePair<int, Double>> _datapoints;

The chart is initialised as below:
radchart.DefaultView.ChartArea.AxisX.AutoRange = false;
radchart.DefaultView.ChartArea.AxisX.AddRange(-100, 100, 50);
radchart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
radchart.DefaultView.ChartArea.AxisY.AutoRange = false;
radchart.DefaultView.ChartArea.AxisY.AddRange(-100, 100, 50);
radchart.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
SeriesMapping sm = new SeriesMapping();
sm.SeriesDefinition = new LineSeriesDefinition();
sm.SeriesDefinition.ShowItemLabels = false;
sm.ItemMappings.Add(new ItemMapping("Key", DataPointMember.XValue));
sm.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
radchart.SeriesMappings.Add(sm);
radchart.ItemsSource = _datapoints;

_datapoints.Add(

new KeyValuePair<int, double>(1, 10.0));

 

_datapoints.Add(

new KeyValuePair<int, double>(50, 20.9));

 

_datapoints.Add(

new KeyValuePair<int, double>(80, 80.1));

 

_datapoints.Add(

new KeyValuePair<int, double>(100, 34.8));

 



I have a button to trigger refresh on the control, who handler is as follows:

private void Refresh_Click(object sender, RoutedEventArgs e)
{           
    _datapoints[0] = new KeyValuePair<int, double>(1, Rnd.Next(-100, 100) *   Rnd.NextDouble());
    _datapoints[1] = new KeyValuePair<int, double>(50, Rnd.Next(-100, 100) * Rnd.NextDouble());
    _datapoints[2] = new KeyValuePair<int, double>(80, Rnd.Next(-100, 100) * Rnd.NextDouble());
    _datapoints[3] = new KeyValuePair<int, double>(100, Rnd.Next(-100, 100) * Rnd.NextDouble());
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Evgeni "Zammy" Petrov
Telerik team
answered on 23 Nov 2010, 01:04 PM
Hello Angshuman,

 Try turning off the animations :

radchart.DefaultView.ChartArea.EnableAnimations = false;

Let me know if this helped you out.

Regards,
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
Chart
Asked by
Angshuman
Top achievements
Rank 2
Answers by
Evgeni "Zammy" Petrov
Telerik team
Share this question
or