Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pie chart label color

Status
Not open for further replies.

garry1

Programmer
Dec 6, 2002
49
US
Hi, Is there a way to specify color for each label in a pie chart. For example for label A green color, label B Blue color, Label C Red color. Thanks.
 
This is from an older version of Actuate, so I'm not sure it works with ver. 7 charts (as I have already found some differences between earlier graphs and current charts).

Modify the code to fit your need, and put it somewhere like ComputeLabels():

Dim iCount As Integer

' Set the number of colors to the number of bars
ValuesColorCount = PointCount

' Initialise color array
Redim ValuesColor(ValuesColorCount)

If PointCount > 0 Then
For iCount = 0 To (PointCount-1)
If Points(0, iCount).Label = "OK" Then
ValuesColor(iCount) = Red
Else
ValuesColor(iCount) = Blue
End If
Next
End If




This checks your CategoryLabel and adds a color to the ValuesColor array depending on its value.

Hope this helps
 
Thanks bcaslow!

One more question. How can I change the color of the Point lables on a pie chart. In the properties of pie chart I can select only one color. I would like to show same color for point labels and Values.
 
As you loop through building your colors, also set PointLabelFont.Color to whatever color:

.
.
.
PointLabelFont.Color = Red
.
.
.


Bill
 
It is setting only one color for all the point lables even if I loop. Here is my code. All the category Point label fonts are showing green color. The value color work fine. How to fix this. Thanks.

For k = 0 to PointCount
If InStr(XLabels(k),"Q") Then
ValuesColor(k) = Blue
PointLabelFont.Color = Blue
ElseIf InStr(XLabels(k),"Z") Then
ValuesColor(k) = Green
PointLabelFont.Color = Green
end if
next
 
Sorry, that was my fault; I didn't test that one. Did you set your PointLabelStyle proprty to ChartColoredTextLabels (or numeric)? You might also need to have your ValuesColorList to coordinate with your color selection you have in code? I'm not sure how (if) this will work, as far as maintaining the correct color pie section to point label color. And sorry, I don't have time to test this one either!
 
Thanks so much bcaslow. After setting to ChartColoredTextLabels it works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top