ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Colours in pie chart
Posted by Dominic on Mar-30-2007 14:38
Chooice of colours in graphs specially the pie chart.

I notice the chartdirector does the following:-
1. the background color of a pie chart is used again in the pie chart.
2. assuming there are 2 parts in a pie chart, good and not good. the colours given are RED for good and Green for not good. Likewise in another scenario for attained marks and lost marks. the colours given are RED for attained marks and Green for lost marks.

How do we change the colours: assuming we want green for good/attained marks and Red for not good/lost marks.

In the observation 1 : how do we remove the background colour (let's say blue) from being used again in the chart itself?

Let me know how to handle these situations.

Thank you.

Dominic.

  Re: Colours in pie chart
Posted by Peter Kwan on Mar-31-2007 03:19
Hi Dominic,

You may specify the sectors to use any colors you want. An code sample is in "ChartDirector Documentation/Pie Chart/Coloring and Wallpaper".

For example, you may specify the colors like (in VB/VBScript):

'first sector green (33ff33), second sector red (ff3333)
myColorTable = Array(&H33ff33, &Hff3333)
Call c.setColors2(cd.DataColor, myColorTable)

The above should solve both of your issues. For (1), you may specify the colors for the sectors so that it does not include the background color. For (2), you may use any colors you like for the sectors, such as using green for good marks and red for lost marks.

If you do not specify the colors, ChartDirector will use an internal pre-defined color table, which may or may not have enough contrast with your background color. (Given a computer can handle 16777216 colors, there can be many types of blue colors. Your background color may not be the same as the sector color, but it may still look the same due to insufficient contrast.)

In general, if there is a chance your background color is in conflict or with insufficient contrast to the internal color table, you may need to use your own color table by using the method above.

Another alternative is to use a border color for the sectors. Some people intentionally use the same color for the background and for the sectors (like using white color for both), and rely on a border to make the sectors clearly visible.

For example:

'use white as the border color - has high contrast to blue
Call c.setLineColor(&Hffffff)

Hope this can help.

Regards
Peter Kwan

  Re: Colours in pie chart
Posted by Kin on Dec-31-2008 11:58
Hi,

I am researching on the color part of chart director. Can I let the user to choose his own
color?

Regards,
Kin

  Re: Colours in pie chart
Posted by Peter Kwan on Dec-31-2008 13:42
Hi Kin,

Yes. I assume you must have a user interface to allow the user to choose the colors. After the user has chosen the colors, you can use it to create the charts. For example:

myColorTable = Array(color1ChosenByUser, color2ChosenByUser)
Call c.setColors2(cd.DataColor, myColorTable)

In the above, the color1ChosenByUser and color2ChosenByUser are the colors chosen by your user, as created by your user interface handling code.

Hope this can help.

Regards
Peter Kwan