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

pie chart

4 Answers 169 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
regis
Top achievements
Rank 1
regis asked on 09 Jul 2009, 10:38 PM
Hi everyone,

i am trying to get a pie chart like those shown on this example  or this one with a legend or serie that would associate a colour with a name.

My problem is that those names are not fixed so i would like to attribute them during runtime. I already use NeedDataSource event for populating the datasource.
Do you have an example where that legend of a pie chart is populating depending of what is in the datasource at run time?

I get trought the documentation but i must have missed something (I am not even sure that it's legend or what and most of the example are with bar chart).

Thank you

regis

4 Answers, 1 is accepted

Sort by
0
regis
Top achievements
Rank 1
answered on 10 Jul 2009, 10:52 PM
0
regis
Top achievements
Rank 1
answered on 13 Jul 2009, 02:52 PM





OracleDataAdapter da = new OracleDataAdapter(sql.ToString(), ConfigurationManager.ConnectionStrings["OraCon"].ConnectionString);  
 
            da.Fill(ds);  
 
            //proChart.DataSource = ds;  
              
            foreach (DataRow dr in ds.Tables[0].Rows)  
            {  
                ChartSeriesItem serieItem = new ChartSeriesItem(double.Parse(dr["count(error_type)"].ToString()));
                  
                serieItem.Name = dr["error_type"].ToString();  
                chart1.Series[0].Items.Add(serieItem);  
                chart1.Series[0].DataYColumn = "count(error_type)";  
                chart1.Series[0].DefaultLabelValue = "#%";  
                            } 

Hi Everyone,

I finally find a thread on the forum that seems to work for me.

My code is above but i am wondering if that would be possible to have the same result by binding the dataset instead of adding items to the series so that i don't have to deal with colors, hatching items per items .

thank you

0
Accepted
Chavdar
Telerik team
answered on 15 Jul 2009, 02:02 PM
Hi regis,

You have found the correct solution. There is no other way to fulfil the requirement as you cannot bind declaratively the item's name and label to different fields from the data source.

Kind regards,
Chavdar
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
regis
Top achievements
Rank 1
answered on 15 Jul 2009, 02:56 PM
All right thank you.
Tags
General Discussions
Asked by
regis
Top achievements
Rank 1
Answers by
regis
Top achievements
Rank 1
Chavdar
Telerik team
Share this question
or