Programmatically select DataPoint in AreaSeries

8 posts, 0 answers
  1. Vikram
    Vikram avatar
    4 posts
    Member since:
    Nov 2015

    Posted 01 Apr Link to this post

    How do i programmatically select a DataPoint in an AreaSeries? 
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Apr Link to this post

    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
  3. DevCraft banner
  4. Vikram
    Vikram avatar
    4 posts
    Member since:
    Nov 2015

    Posted 05 Apr in reply to Victor Link to this post

    How do I retrieve a specific DataPoint for a series? Let's say the last one.
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Apr Link to this post

    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
  6. Vikram
    Vikram avatar
    4 posts
    Member since:
    Nov 2015

    Posted 05 Apr in reply to Victor Link to this post

    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
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 08 Apr Link to this post

    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
  8. Manikandan
    Manikandan avatar
    2 posts
    Member since:
    Jun 2016

    Posted 26 Aug Link to this post

    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

  9. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 29 Aug Link to this post

    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
Back to Top
DevCraft banner