Jump to content
Software FX Community

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


bodhisatta1984
 Share

Recommended Posts

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 =

False

Chart1.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 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 =

False

Chart1.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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...