Jump to content
Software FX Community

Re: Different coloured bars


User (Legacy)
 Share

Recommended Posts

I think this from the Chart FX's programmer's guide might help:

Assigning individual colors to markers

In some cases, you don't want colors associated by series, you want to be able to assign colors individually by marker. For example, if you have a bar chart and you want bars with negative values to be red and bars with positive values to be blue, the code shown above will not do the trick for you because each color is associated with an entire series instead of an specific marker.

In order to associate colors by marker, all you need to do is use the MultipleColors property. When turned on this property will force Chart FX to paint markers with different colors, even if they belong to the same series.

For example if you want to assign red to those bars with negative values and blue with values greater than zero, your code should look like:

'First Turn on the MultipleColors property

Chart1.MultipleColors = TRUE

'Then open the comm. channel with COD_COLORS.

Chart1.OpenDataEx COD_COLORS,2,0

'Obtain the total number of points

nTotalPoints=Chart1.nValues

'Finally assign colors depending on their value using the Color Property

for j=0 to (nValues-1)

if (Chart1.Value(j) <0) Then

Chart1.Color(j) = RGB(0,0,255)

else

Chart1.Color(j) = RGB(255,0,0)

End If

Next j

Chart1.CloseData COD_COLORS

--

FP

Software FX

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