Dynamically changing colors and patterns in a chart

M

MFH

I would like to be able to link colors and patterns to each of the categories
in my pie chart in access. In other words, everytime I display a new chart, I
want to have the same colors show up for the same category. I also need to
use about 55 colors and 2 different patterns in combination with each other.
For example, category A would aleways show up as blue, category b would
always show up as red, category c would always show up as green polka dots,
etc.
 
M

MK

I just finished doing this! I did it by creating a table that contained the
categories that were in my chart with a field for the color. I used the
colorindex property - the code was reasonably simple. After the chart is
populated I used a recordset to get the categories in the chart and then used
the fields from that recordset to set the colors.

myChart.SeriesCollection(rst.Fields(0)).MarkerBackgroundColorIndex =
rst.Fields(1)
myChart.SeriesCollection(rst.Fields(0)).MarkerForegroundColorIndex =
rst.Fields(1)
myChart.SeriesCollection(rst.Fields(0)).Border.ColorIndex = rst.Fields(1)

I did this by looping through the recordset. - Note when manipulating chart
properties you'll often get error number 1004 - I did some digging and
Microsoft's answer to this is to simply resume next. I hope this helps.
 
M

MFH

Thanks, I am glad that it is possible. Could you please give me an example of
your code? I am not affluent in visual basic.
 

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