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

How to add multiple attributes to chartseries or chartseriesitem

1 Answer 71 Views
Dock
This is a migrated thread and some comments may be shown as answers.
anand
Top achievements
Rank 1
anand asked on 22 Jan 2009, 06:12 AM
hi,

I am using  drill down feature of radchart, but i am not able to add multiple attributes to chartseries or chartitems.

i am fetching first formats from database, and showing that formats in graph, at that time i am adding  format ID as chartseriesitem`s attributes, but when i click on any one format i want to show that format related section, now i want formatID and SectionID as attributes, to drilldown sections.

Thanks & Regards
anand gole

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 26 Jan 2009, 08:49 AM
Hello anand,

We are not quite sure where are you trying to add the attribute information, but if you are using the ActiveRegion.Attributes property there is no problem to add multiple attributes and retrieve them on click event like this:

protected void Page_Load(object sender, EventArgs e) 
    if (!IsPostBack) 
    { 
        ChartSeries series = new ChartSeries(); 
 
        ChartSeriesItem seriesItem = new ChartSeriesItem(); 
        seriesItem.YValue = 20
        seriesItem.ActiveRegion.Attributes = "attribute1=test;attribute2=test2"
        series.Items.Add(seriesItem); 
 
        ChartSeriesItem seriesItem2 = new ChartSeriesItem(); 
        seriesItem2.YValue = 30
        seriesItem2.ActiveRegion.Attributes = "attribute3=test3;attribute4=test4"
        series.Items.Add(seriesItem2); 
 
        RadChart1.Series.Add(series); 
    } 
 
protected void RadChart1_Click(object sender, ChartClickEventArgs args) 
    if (args.SeriesItem != null) 
    { 
        string[] attributes = args.SeriesItem.ActiveRegion.Attributes.Split(';'); 
 
        foreach (string attribute in attributes) 
        { 
            string[] keyValuePair = attribute.Split('='); 
            Response.Write(string.Format("{0} : {1}", keyValuePair[0], keyValuePair[1])); 
            Response.Write("<br />"); 
        } 
    } 


You can also review the drill-down example online here that uses the Viewstate to preserve the state information in the drill-down process.


Sincerely yours,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Dock
Asked by
anand
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or