Jump to content
Software FX Community

Assign Colours to Points from Palette


User (Legacy)

Recommended Posts

Chartfx automatically assigns a colour to a point according to the current

palette.

I can change the colour of individual points in code using

chart1.Point[n,0].Color = Color.Red etc

What I want to be able to do is us the current palette and assign the 3rd

etc colour from the palette. Is there a way of querying the colours in the

current palette?

Thanks

Link to comment
Share on other sites

Hello,

No there is no easy way of doing this. I would suggest making your own

palette this way you know what colors are present in the palette and in

which order they appear. http://support.softwarefx.com/kb/600/1/019.htm

JT

Tech. Support

"J Moulder" <q> wrote in message news:Jy$7ccbUDHA.1484@WEBSERVER1...

> Chartfx automatically assigns a colour to a point according to the current

> palette.

>

> I can change the colour of individual points in code using

> chart1.Point[n,0].Color = Color.Red etc

>

> What I want to be able to do is us the current palette and assign the 3rd

> etc colour from the palette. Is there a way of querying the colours in the

> current palette?

>

> Thanks

>

>

Link to comment
Share on other sites

There is no way of selecting a specific color in the palette. Colors are

either set to a specific color or left to be defaulted to a color in the

palette. Each element defaults to a specific entry in the palette.

The question here is, why would you want to access the third color of the

palette, the color that you will get back is going to be completely

arbitrary, as we design the palettes with no particular order in mind.

You might want to get what's the default color for a particular series (say

series 3) this you can obtain by doing:

Color color = chart.Series[2].Color;

Is this what you are looking for ?

--

FP

Software FX, Inc.

Link to comment
Share on other sites

> The question here is, why would you want to access the third color of the

> palette, the color that you will get back is going to be completely

> arbitrary, as we design the palettes with no particular order in mind.

I'll explain a little bit more about the application.

We are using a Gantt chart to show the activity in a process control

application. A defined of tasks are perfomed on an item. There are many

items. Each task takes an amount of time. The Gantt chart displays each task

performed on the item as a single row. The next item and its tasks is shown

on the next row . The Gantt chart helpfully colours the first task red

(say), the second task blue and so on. This is fine.

We can have several different sets of tasks that we can perform on a given

item. This is where things get interesting.

Consider item A, where we do tasks 1,2,3,4,5, and item B where we do tasks

1,3,5

Item A is shown in the Gantt chart, and lets assume that Chartfx

automatically assigns colours to the tasks, according to the current palette

as follows:

task 1 : red

task 2 : blue

task 3 : yellow

task 4 : green

task 5 : orange

Add item B to the chart, and we would get the following colour assignment:

task 1 : red (the 1st from the palette)

task 3 : blue (the 2nd colour from the palette)

task 5 : yellow (the 3rd colour from the palette)

This is the same automatic allocation of colours as before.

What we expect is as follows:

task 1 : red (correct)

task 3 : yellow (not blue)

task 5 : orange (not yellow)

This is why I need to access the Nth color of the palette.

John

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:OpvNzdfUDHA.3012@WEBSERVER1...

> There is no way of selecting a specific color in the palette. Colors are

> either set to a specific color or left to be defaulted to a color in the

> palette. Each element defaults to a specific entry in the palette.

>

> The question here is, why would you want to access the third color of the

> palette, the color that you will get back is going to be completely

> arbitrary, as we design the palettes with no particular order in mind.

>

> You might want to get what's the default color for a particular series

(say

> series 3) this you can obtain by doing:

>

> Color color = chart.Series[2].Color;

>

> Is this what you are looking for ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

So you do, indeed need is the order in which colors are assigned to series.

What you can do is to fill an array of 16 colors (this is how many colors we

assign automatically, after 16 we cycle) and initialize it with:

Series[0].Color

Series[1].Color

...

Series[15].Color

Do this at the beginning of your program before assigning any custom colors.

Then assign colors to each point according to this array. In other words

this array will provide you the palette functionality you are looking for.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...