This question is locked. New answers and comments are not allowed.
Xavier Soares
Top achievements
Rank 2
Xavier Soares
asked on 15 Sep 2008, 03:41 PM
Hello,
Is it possible in pie chart show the slice name and correspondent value?
I only can show or one or other.
Thank you.
LM
4 Answers, 1 is accepted
0
Hi Luis,
Thank you for contacting us. There are two solutions to the problem:
Regards,
Evtim
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for contacting us. There are two solutions to the problem:
- Handle the ItemDataBound event and set the corresponding label's text to the one you want. Through the event arguments you can access the data item that is currently binding to the ChartItem.
- If your data source is DataTable, create a new expression column, which concatenates the label and the value. Then use this column as source for the pie chart's labels.
Regards,
Evtim
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Xavier Soares
Top achievements
Rank 2
answered on 16 Sep 2008, 09:43 AM
Hello,
The second option don't seems to help because I need to show the name and the corresponding percentage, not the value.
Can you give an hand with the first option?
By the way, the sample that is in the RadChart help is what I need (Mailbox Space in Rad Chart Basics).
Thank You.
LM
The second option don't seems to help because I need to show the name and the corresponding percentage, not the value.
Can you give an hand with the first option?
By the way, the sample that is in the RadChart help is what I need (Mailbox Space in Rad Chart Basics).
Thank You.
LM
0
Hello Luis,
This approach requires you to handle the ItemDataBound event. Here is a sample handler method:
Note, that the current example assumes the data source is DataTable and the data item supplied is DataRowView. The #% in the string tells the chart that it should put percentage at that place in the string.
Regards,
Evtim
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This approach requires you to handle the ItemDataBound event. Here is a sample handler method:
void radChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e) | |
{ | |
DataRowView row = e.DataItem as DataRowView; | |
e.SeriesItem.Label.TextBlock.Text = string.Format("{0}, value = #%", row["Text"]); | |
} |
Regards,
Evtim
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Xavier Soares
Top achievements
Rank 2
answered on 19 Sep 2008, 12:58 PM
Worked! Thank You.
LM
LM