Pie chart segment colors using VBA?

  • Thread starter Thread starter QB
  • Start date Start date
Q

QB

I created a pie chart based on a query. Then I set it up so the first data
series was green, 2nd blue, 3rd yellow and 4th red. However, I just noticed
that there are not always 4 sets of data series and that this then throws off
the color association.

My data query is structured as follows

Type Color Number
A Green 14
A Bleu 7
A Yellow 3
A Red 1
B Green 22
B Bleu 3
B Yellow 19
B Red 5

Like I said though, depending on user selections it could return
Type Color Number
A Green 6
A Bleu 2
B Red 3

Is there a way to assign the color when the chart is generated based on the
data series name? Or is there a way to make my query return 0s (see below)
so that the data series are always there so they get associated with the
proper color?

Type Color Number
A Green 6
A Bleu 2
A Yellow 0
A Red 0
B Green 0
B Bleu 0
B Yellow 0
B Red 3

Thank you for the insight!

QB
 
I expect it might be easiest to "make my query return 0s" but we have no idea
about your tables or fields.
 
Back
Top