ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   fixing pie chart colors depending upon value ? (https://www.excelbanter.com/charts-charting-excel/207776-fixing-pie-chart-colors-depending-upon-value.html)

Howard

fixing pie chart colors depending upon value ?
 
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




Jon Peltier

fixing pie chart colors depending upon value ?
 
The technique described in this blog post will work on any chart type that
uses a fill color:

http://peltiertech.com/WordPress/200...ategory-label/

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Howard" wrote in message
...
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






Howard

fixing pie chart colors depending upon value ?
 
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).DataL abel.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).Inter ior.Color = RGB(255, 0,
0)
Else 'the good slice, make it green
Me.chart1.SeriesCollection(1).Points.Item(1).Inter ior.Color = RGB(0, 255,
0)
End If

End Sub


"Jon Peltier" wrote in message
...
The technique described in this blog post will work on any chart type that
uses a fill color:

http://peltiertech.com/WordPress/200...ategory-label/

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Howard" wrote in message
...
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









All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com