To get Chart clicked item value

2 posts, 0 answers
  1. lekha
    lekha avatar
    35 posts
    Member since:
    May 2009

    Posted 02 Jul 2010 Link to this post

    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

  2. lekha
    lekha avatar
    35 posts
    Member since:
    May 2009

    Posted 03 Jul 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top