Jump to content
Software FX Community

Trying to set different customized colors for different range of values in Surface chart


Recommended Posts


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 =


Chart1.LegendBox.ItemAttributes(Chart1.Series) = legendItem


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 Integer

i = 0

For Each ValueRange In RangesDim RangeCond As New ConditionalAttributes

RangeCond.Condition.From = Ranges(i)

If (i < Ranges.Length - 1) Then

RangeCond.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 If

RangeCond.Color = RangeColors(i)

RangeCond.PointLabels.Visible =



RangeCond.Condition.DataElement = Internal.DataElement.YValue

i = i + 1



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.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...