Jump to content
Software FX Community

Re: Different coloured bars

User (Legacy)

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


'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)


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

End If

Next j

Chart1.CloseData COD_COLORS



Software FX

Link to comment
Share on other sites


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

  • Create New...