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

To get Chart clicked item value

1 Answer 125 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
lekha
Top achievements
Rank 1
lekha asked on 02 Jul 2010, 10:44 AM
Hi all,
   I used rad chart. I want to display Building names in X axis and Maximm allowed persons in each building in Y axis. Ok. Then when i click on each building(bar) i want to load another chart,  So i want to know the ID field of the Building.
I used the code like this for X Axis.
 Chartabc.PlotArea.XAxis.DataLabelsColumn = "BuildingName";
I want to store the BuildingId also. How can i achieve it and How can i retreive the BuildingId on each Chart Click Event???


Its urgent please reply,
Thanks In Advance,
Lekha

1 Answer, 1 is accepted

Sort by
0
lekha
Top achievements
Rank 1
answered on 03 Jul 2010, 11:19 AM
Hi,
    I got the answer regarding my question.I used radchart's examples in the link
http://demos.telerik.com/aspnet-ajax/chart/examples/programming/postback/defaultcs.aspx

Here I set the values (BuildingId) in the Series items

 foreach (ChartSeries series in Chart1.Series)
        {
            int itemIndex = 0;

            foreach (ChartSeriesItem item in series.Items)
            {
                item.Name = dtBuilding.Rows[itemIndex]["BuildingId"].ToString();
                itemIndex++;
            }
        }
and on clicking each item i can retrieve the value by using the code
protected void Chart1_Click(object sender, Telerik.Charting.ChartClickEventArgs args)
{
 decimal dcBuildingId = Convert.ToDecimal(args.SeriesItem.Name);
}

Is there any other solutions? Please reply
Lekha
Tags
Chart (obsolete as of Q1 2013)
Asked by
lekha
Top achievements
Rank 1
Answers by
lekha
Top achievements
Rank 1
Share this question
or