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

ItemClick To Select LineSeries Data Point

3 Answers 104 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.
John
Top achievements
Rank 1
John asked on 23 Jan 2012, 11:43 PM
Are there any examples for how to use the ItemClick event to select individual data points on a LineSeries?

3 Answers, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 2
answered on 26 Jan 2012, 09:04 PM
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
0
Accepted
Tsvetie
Telerik team
answered on 27 Jan 2012, 08:30 AM
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 >>

0
John
Top achievements
Rank 1
answered on 27 Jan 2012, 03:00 PM
This is a fantastic solution. Thank you so much for finding this post for me! It absolutely works like a charm.
Tags
Chart
Asked by
John
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 2
Tsvetie
Telerik team
John
Top achievements
Rank 1
Share this question
or