fixing pie chart colors depending upon value ?

H

Howard

This is really about using an excel chart inside an access report but nobody
in microsoft.access.reports seems to know the answer.

Using a grouped field in a database I end up with two values per record
showing the number of 'goods' and the number of 'bads' The pie chart plots
these two numbers. I want the 'good' slice always to be green and the 'bad'
slice always to be red.

Setting the format worked OK until I had 7 goods and zero bads, then the
whole chart was red instead of green.

Any idea how I can fix this?

Howard
 
H

Howard

Thanks, That didn't quite do it but it pointed me in the right direction. In
case anyone else wants to know how to do it this code finally worked.

Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)

Dim v As Variant

v = Me.chart1.SeriesCollection(1).Points.Item(1).DataLabel.Text
If UCase(Left(v, 1)) = "B" Then 'label starts with B - the bad slice, make
it red
Me.chart1.SeriesCollection(1).Points.Item(1).Interior.Color = RGB(255, 0,
0)
Else 'the good slice, make it green
Me.chart1.SeriesCollection(1).Points.Item(1).Interior.Color = RGB(0, 255,
0)
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top