Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1060
Custom Color on Pie Chart not similar On Legend
posted

I have a requirement where i need to manually set the color on a pie chart.

Dim iRow As Integer
Dim paintElement As PaintElement
For Each r As DataRow In dt.Rows
Dim o As Override = New Override()
o.Row = iRow
o.Column = 0
Dim sColor() As String
sColor = r.Item(2).ToString.Split(",")
paintElement = New PaintElement()
paintElement.ElementType = PaintElementType.SolidFill
paintElement.Fill = Color.FromArgb(sColor(0), sColor(1), sColor(2), sColor(3))
o.PE = paintElement

chart.Override.Add(o)

iRow += 1
Next

this works like a charm.  However, when I look at the Legend, the colors are not matching.  I assume I have to do an override for the legend colors as well.  

How can I do That ?