How to get SeriesItem name on drill down?

Thread is closed for posting
6 posts, 0 answers
  1. dajegas
    dajegas avatar
    3 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2012 Link to this post

    Hello all,

    I'm learning to use the RadChart control and I'd like to ask how to dynamically get the name of the series item that generated the RadChart.Click event to use it as part of the series name for the next chart generated (ex. if the chart shows the sales volumes per month in an given year and the user clicks on the July column, the next chart should show the details for July and the series name would be "Sales details for July").

    Any help would be really appreciated!
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Sep 2012 Link to this post

    Hello,

    You can get the name of the series item on RadChart Click event as follows.

    C#:
    protected void RadChart2_Click(object sender, ChartClickEventArgs args)
    {
       Response.Write(args.SeriesItem.Name.ToString());
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. dajegas
    dajegas avatar
    3 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post

    Hi Princy,

    thanks for your reply, but unfortunately it does not work...

    When I use the statement you posted I get a generic "Item n" value which I believe is some kind of default value.

    Here is how I bind the data to the chart:
    string dlColumn = string.Empty;
    DataTable tblSeries = FillSeries(ref dlColumn);
    radChart.DataSource = tblSeries;
     
    radChart.PlotArea.XAxis.DataLabelsColumn = dlColumn;
    radChart.DataBound += new EventHandler(radChart_DataBound);
    radChart.DataBind();
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 28 Sep 2012 Link to this post

    Hi Alessio,

    I believe Princy's reply is correct, however it depends on the way the ChartSeries.Name is set. If you have auto-generated series RadChart will put as their name the name of the column used to provide values (RadChart1  in the attached example -- the name is Value). If you have created the ChartSeries and assigned its DataYColumn property, then you should set its name, so that you can retrieve it in Click event handler (RadChart2 in the attached example - the name is My Series).

    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. dajegas
    dajegas avatar
    3 posts
    Member since:
    Sep 2012

    Posted 28 Sep 2012 Link to this post

    Hi Ves,

    thanks a lot for your example, but it's having the same behavior as in my code...
    I can control the Series.Name but what I'm interested in is getting the SeriesItem.Name the user has clicked on.

    I changed your example in

    protected void RadChart1_Click(object sender, Telerik.Charting.ChartClickEventArgs args)
    {
        Response.Write(args.SeriesItem.Name);
    }


    but if I click on one of the columns I'd like to have the "Namex" printed but instead I get the usual "Itemx".
  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 03 Oct 2012 Link to this post

    Hi,

    In order to retrieve the SeriesItem.Name it should be set properly before that. You can do this in ItemDataBound event. Please, find attached an updated version of the example.

    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017