Hi,
According to this thread: https://www.telerik.com/forums/how-to-force-series-color
Children collection should be used to set specific color for pie element
radChartView1.Series[0].Children[0].BackColor = Color.Red;
However, I noticed "strange" behavior in data bound mode: As soon as reference to Children is made labels are not shown.
You can see this behavior in sample below:
Uncomment any of 2 lines below and you can see labels are not there
'series.Children(i).BackColor = Color.AntiqueWhite
'Dim point = CType(series.Children(i), DataPointElement)
Simple form with load event:
Imports
Telerik.WinControls.UI
Public
Class
Form1
Private
Sub
Form1_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
Dim
chart =
New
RadChartView()
chart.AreaType = ChartAreaType.Pie
Me
.Controls.Add(chart)
Dim
series =
New
PieSeries(
"ValueMember"
,
"CategoryMember"
)
Dim
dataSource =
New
List(Of DataItem)
dataSource.Add(
New
DataItem(
"10"
,
"test1"
))
dataSource.Add(
New
DataItem(
"10"
,
"test2"
))
dataSource.Add(
New
DataItem(
"10"
,
"test3"
))
dataSource.Add(
New
DataItem(
"10"
,
"test4"
))
series.ShowLabels =
True
series.DataSource = dataSource
For
i = 0
To
series.Children.Count - 1
'series.Children(i).BackColor = Color.AntiqueWhite
'Dim point = CType(series.Children(i), DataPointElement)
Next
chart.Series.Add(series)
End
Sub
End
Class
And data object:
Public
Class
DataItem
Public
Property
ValueMember
As
String
Public
Property
CategoryMember
As
String
Public
Sub
New
(valueM
As
String
, categoryM
As
String
)
ValueMember = valueM
CategoryMember = categoryM
End
Sub
End
Class