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

How to choose a different background color for a chart label

5 Answers 553 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
developer10214
Top achievements
Rank 1
developer10214 asked on 09 Dec 2012, 04:45 PM
Hello,

I have pie chart and assigned a custom palette with 4 colors (red, green, orange and blue), only first fill color, no additional setting. This works well so far. I also want to display the according labels. This works also, but all the labels have the same background color as it corrensponding data point/segment. That I would like to change.
When I don't use any palette than each segement has its own color but the all the labels have white background.

Is there a way to change the background color of the labels?

5 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Petrov
Telerik team
answered on 12 Dec 2012, 05:41 PM
Hello,

Thank you for writing.

You can use the LableFormatting event of RadChartView to style lables. Here is an example which demonstrates how to make all labels with white back color:
private void radChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e)
{
  e.LabelElement.BackColor = Color.Red;
}

I hope this will help. Should you have further questions, I would be glad to help. 
 
Kind regards,
Ivan Petrov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
developer10214
Top achievements
Rank 1
answered on 13 Dec 2012, 09:07 AM
Thank you for your answer. It works.
Is there a chance that the Appearance-Properties as they where in the RadChart will be available in RadChartView too?

0
Ivan Petrov
Telerik team
answered on 18 Dec 2012, 10:28 AM
Hi,

Thank you for writing.

RadChartView elements can be accessed and styled like every other control. You can access a label element using the following code:
this.radChartView1.Series[0].Children[0].Children[0]
In this example the series element has a collection of child elements which are the individual data points elements. Each data point element has a child element which is the label element.
All elements in the chart view element hierarchy derive from UIChartElement. This is an element which has style properties and can be drawn within the chart control.

I hope this is useful. Feel free to write back, should you need further assistance or more information.
 
Kind regards,
Ivan Petrov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Gokul
Top achievements
Rank 1
answered on 25 Aug 2015, 11:36 AM

can anyone give a clarification to a problem in this link

http://www.telerik.com/forums/pie-chart-default-colours-so-similar#LidchSH-bUOZVpwvLZ1-oA

0
Stefan
Telerik team
answered on 25 Aug 2015, 11:44 AM
Hi,

The link you have posted is from our UI for ASP.NET AJAX while the forum here concerns UI for WinForms. Please make sure you are posting in the proper forum to get answer. 
Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ChartView
Asked by
developer10214
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
developer10214
Top achievements
Rank 1
Gokul
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or