5 Answers, 1 is accepted
0
Hello Sivakumar,
This behavior is expected because when you switch the series you create a new series object different than the previous one which has different DataPoint models. In order to achieve your requirement you can use the SelectedPoints collection of the chart to save your view models when the old series is removed and when you add the new one you can use the saved models to select the new generated data points.
Regards,
Martin
Telerik
This behavior is expected because when you switch the series you create a new series object different than the previous one which has different DataPoint models. In order to achieve your requirement you can use the SelectedPoints collection of the chart to save your view models when the old series is removed and when you add the new one you can use the saved models to select the new generated data points.
Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Sivakumar
Top achievements
Rank 1
answered on 12 Apr 2016, 03:53 AM
I am using same data-point model only.I am just switching the series.I am saving currently selected data point model but i am not sure under which event i can assign this saved data model when new series created. I already tried with series created event but there data point not generated yet.please help
and also chart first series first point need to be selected after chart loaded..please help how to do this also..
Can you please provide sample code ?
0
Sivakumar
Top achievements
Rank 1
answered on 12 Apr 2016, 03:58 AM
Please find code below..
private
void
ChartSeriesProvider_SeriesCreated(
object
sender, ChartSeriesCreatedEventArgs e)
{
//todo : retain selected point while switching series
if
(selectedPoint !=
null
)
{
var series = selectedPoint.Presenter
as
CategoricalSeries;
//var pointToSelect = series.DataPoints[nextSelectedIndex - 1];
}
//select firstpoint
if
(chart.SelectedPoints.Count == 0)
{
var pointToSelect = (e.Series
as
CategoricalSeries).DataPoints[0];
pointToSelect.IsSelected =
true
;
}
}
0
Accepted
Hello Sivakumar,
The data points of the series are not yet generated in the SeriesCreated event and this is why you cannot get them. You can use the DataBindingComplete event of the series instead.
I created a small example demonstrating a possible approach for achieving your requirement. I hope it works for you.
Regards,
Martin
Telerik
The data points of the series are not yet generated in the SeriesCreated event and this is why you cannot get them. You can use the DataBindingComplete event of the series instead.
I created a small example demonstrating a possible approach for achieving your requirement. I hope it works for you.
Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Sivakumar
Top achievements
Rank 1
answered on 13 Apr 2016, 01:06 AM
Thanks Martin...Your solution is working