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

SelectItem question

1 Answer 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Normand
Top achievements
Rank 1
Normand asked on 26 Apr 2011, 02:26 PM

Hi,

 

I have a Pie Chart and the following code:

 

DataSeries series = new DataSeries();
series.Definition = new PieSeriesDefinition();
series.Definition.InteractivitySettings.SelectionMode = ChartSelectionMode.Single;
series.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Item;
 
series.Add(new DataPoint(1));
series.Add(new DataPoint(2));
series.Add(new DataPoint(3));
series.Add(new DataPoint(4));
radChart.DefaultView.ChartArea.DataSeries.Add(series);
radChart.DefaultView.ChartArea.SelectItem(0);

 

What I would like to do is to “pre-select” an item immediately after generating the chart. However, the SelectItem in my code doesn’t work because it seems the SelectItem needs the chart to first be rendered. If I call the SelectItem from a timer (and then the chart has been rendered), then it works. Is there a way to call the SelectItem when the chart hasn’t been rendered? Or is there a way to know when the chart and the different elements  have been generated so that the SelectItem will work?

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 29 Apr 2011, 01:20 PM
Hello Normand,
You can use the following approach:
DataSeries series = new DataSeries();
series.Definition = new PieSeriesDefinition();
series.Definition.InteractivitySettings.SelectionMode = ChartSelectionMode.Single;
series.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Item;
 
series.Add(new DataPoint(1));
series.Add(new DataPoint(2));
series.Add(new DataPoint(3));
series.Add(new DataPoint(4));
RadChart1.DefaultView.ChartArea.DataSeries.Add(series);
 
Dispatcher.BeginInvoke((Action)(() => RadChart1.DefaultView.ChartArea.SelectItem(0)));

Regards,
Tsvetie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Normand
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or