Xlcolorindexautomatic With Validation

  • Hi,


    I am building several line charts dynamically via VBA, and each chart has multiple lines. Since I don't know how many lines a chart would have, I use the xlColorIndexAutomatic value for xlColorIndex property of the lines. The problem I ran into is that Excel would automatically generate yellow lines against a white background, making these lines difficult to see. Is there a way to modify, or validate the color index values generated by xlColorIndexAutomatic so that lighter colors, such as yellow, would not be used against a white background? I tried to read and validate the colorindex property of each series object, but it seems that they are aways equal to -4105 once xlColorIndexAutomatic was assigned to a series, e.g., all colored lines would have -4105 as their color index value.


    Thanks,


    Tom

  • Re: Xlcolorindexautomatic With Validation


    I am a little surprised that xlColorIndexAutomatic would return a Yellow line on a white background, which leads me to believe that it may not actually be 'really' white... but still Yellow seems a bit of an odd choice. I dont think you directly influence the behaviour of an "Automatic" selection, because then it becomes not so automatic... : D . So much for Artificial Intelligence knowing best.


    Anyway, only suggestion I have is to specificially set it yourself to a dark colour using the RGB function, like RGB(0,0,0) which is black.... Sorry I cant be of more help. You could make it fancy with an 'Adjust the Color of this line / point" slide rule type control that would increase the RGB values from (0,0,0) to (255,255,255)


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Xlcolorindexautomatic With Validation


    Or you could change the colors in the chart fills and lines section (the lower 16 entries) of the color palette.

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Xlcolorindexautomatic With Validation


    As shg has pointed out the color pallete contains the chart line and fill colours.


    In a default pallete the 3rd line colour is yellow. But the default plotarea of a chart is gray. So it would be quite visible on a default chart.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!