ItemClick To Select LineSeries Data Point

4 posts, 1 answers
  1. John
    John avatar
    5 posts
    Member since:
    Jan 2012

    Posted 23 Jan 2012 Link to this post

    Are there any examples for how to use the ItemClick event to select individual data points on a LineSeries?
  2. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 26 Jan 2012 Link to this post

    Hi John,

                This is my sample code for selecting values from chart Data Points
    radChart.DefaultView.ChartArea.ItemClick += new EventHandler<ChartItemClickEventArgs>(ChartArea_ItemClick);


    void ChartArea_ItemClick(object sender, ChartItemClickEventArgs e)
            {
                int diseaseID = Convert.ToInt32(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).DiseaseId);
                DiseaseIDGlobal = diseaseID;
                int isPrograms = 1;
                string measureRange = e.DataPoint.LegendLabel.ToString();
                switch (e.DataPoint.LegendLabel.ToString())
                {
                    case "Good":
                        txtDiseaseDrillDown.Text = "[Disease Name- " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).DiseaseFullName) + "]   -   [Measure  -  " + e.DataPoint.LegendLabel.ToString() + "]  -  [# of Pts : " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).Good) + "]";
                        break;
                    case "Fair":
                        txtDiseaseDrillDown.Text = "[Disease Name- " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).DiseaseFullName) + "]   -   [Measure  -  " + e.DataPoint.LegendLabel.ToString() + "  -  [# of Pts : " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).Fair) + "]";
                        break;
                    case "Poor":
                        txtDiseaseDrillDown.Text = "[Disease Name- " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).DiseaseFullName) + "]   -   [Measure  -  " + e.DataPoint.LegendLabel.ToString() + "]  -  [# of Pts : " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).Poor) + "]";
                        break;
                    case "Undefined":
                        txtDiseaseDrillDown.Text = "[Disease Name- " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).DiseaseFullName) + "]   -   [Measure  -  " + e.DataPoint.LegendLabel.ToString() + "]  -  [# of Pts : " + Convert.ToString(((AnalyticsReports.ReportServiceReference.CareProviderDisease)(e.DataPoint.DataItem)).UnDefined) + "]";
                        break;
                }
    }

    Hope it will help you.

    Regards
    Rahul
  3. DevCraft banner
  4. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 27 Jan 2012 Link to this post

    Hello John,

    For additional details and code sample, please refer to this blog post. The solution that it describes is actually very similar to the one that Rahul suggested.

    Kind regards,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. John
    John avatar
    5 posts
    Member since:
    Jan 2012

    Posted 27 Jan 2012 Link to this post

    This is a fantastic solution. Thank you so much for finding this post for me! It absolutely works like a charm.
Back to Top