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

Programmatically select DataPoint in AreaSeries

7 Answers 106 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vikram
Top achievements
Rank 1
Vikram asked on 01 Apr 2016, 07:32 PM
How do i programmatically select a DataPoint in an AreaSeries? 

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 05 Apr 2016, 07:40 AM
Hi Vikram,

Thank you for writing.
Each data point has an IsSelected property that you can set.

Regards,
Victor
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Vikram
Top achievements
Rank 1
answered on 05 Apr 2016, 02:03 PM
How do I retrieve a specific DataPoint for a series? Let's say the last one.
0
Victor
Telerik team
answered on 05 Apr 2016, 03:15 PM
Hi Vikram,

You can get the last point like this:
DataPointCollection points = series.model().dataPoints();
DataPoint lastPoint = (DataPoint)points.get(points.size() - 1);
Let us know if you need further assistance.

Regards,
Victor
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Vikram
Top achievements
Rank 1
answered on 05 Apr 2016, 03:20 PM
Thank you. One more question. If I select a DataPoint programmatically, I notice that the ChartSelectionChangeListener is not notified. What API do I call to make sure the chart selection is updated? Thanks, Vikram
0
Victor
Telerik team
answered on 08 Apr 2016, 03:28 PM
Hi Vikram,

Thanks for writing.
This appears to be a bug. The data point selection change is not propagated to the selection behavior. Currently the only way to detect the selection is to inherit from your series and override this method:
protected void onDataPointSelectionChanged(DataPoint point);
For example:
public class CustomBarSeries extends BarSeries {
    @Override
    public void onDataPointIsSelectedChanged(DataPoint point) {
        super.onDataPointIsSelectedChanged(point);
        // Do something with selected data point.
    }
}

Please write again if you need further assistance.

Regards,
Victor
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Manikandan
Top achievements
Rank 1
answered on 26 Aug 2016, 06:56 AM

Hi,

I am trying to programatically select the pie chart on click of a button. And I expect the pie chart selection behavior (The selected slice to be shown detached from the pie). I tried pieSeries.model().dataPoints().get(0).setIsSelected(true);, but I dont see the selected behavior. Can you help?

 

Regards,

Manikandan

0
Victor
Telerik team
answered on 29 Aug 2016, 11:51 AM
Hello Manikandan,

Thank you for writing.
Can you please post a support ticket and attach your app so that I can debug it. I tested a pie chart and called pieSeries.dataPoints().get(0).setIsSelected(true) and the points gets selected normally.

Regards,
Victor
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Vikram
Top achievements
Rank 1
Answers by
Victor
Telerik team
Vikram
Top achievements
Rank 1
Manikandan
Top achievements
Rank 1
Share this question
or