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
The chart is initialised as below:
I have a button to trigger refresh on the control, who handler is as follows:
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());
}