Hi
I need display a surface chart with different range of data with different colors. The range and colors needs to be changed programatically. My surface chart has 24 series. I tried using this code to add ConditionalAttributes.
Dim legendItem As New LegendItemAttributes legendItem.Visible =
FalseChart1.LegendBox.ItemAttributes(Chart1.Series) = legendItem
Chart1.LegendBox.ItemAttributes.Clear()
Dim Ranges() As Integer = {0, 30, 40, 50, 60, 70, 80}
Dim RangeColors() As Color = {Color.MediumSeaGreen, Color.LightGreen, Color.LightBlue, Color.Yellow, Color.Orange, Color.Salmon, Color.MediumPurple}
Dim i As Integer
Dim ValueRange As Integeri = 0
For Each ValueRange In RangesDim RangeCond As New ConditionalAttributes RangeCond.Condition.From = Ranges(i)
If (i < Ranges.Length - 1) ThenRangeCond.Condition.To = Ranges(i + 1)
RangeCond.Text =
"Range (" + Ranges(i).ToString() + "-" + Ranges(i + 1).ToString() + ")"
ElseRangeCond.Condition.To = Double.PositiveInfinity RangeCond.Text =
"Range>=" + Ranges(i).ToString()
End IfRangeCond.Color = RangeColors(i)
RangeCond.PointLabels.Visible =
FalseChart1.ConditionalAttributes.Add(RangeCond)
RangeCond.Condition.DataElement = Internal.DataElement.YValue
i = i + 1
Next
The result is :
ConditionalAttributes are shown in LegendBox along with autogenerated items with their own color scheme and chart also does not refect the customized colors.