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

Message ListMessage List     Post MessagePost Message

Posted by FWinds on Jul-24-2019 21:02

I am maintaining a legacy application that use ChartDirector 5.0.

I have a contour chart that I would like to independently set the colors and scale.

I can see that in v 6.0 this can achieved by the ColorAxis.setColorScale method but this is absent in v 5.0.

Is there an equivalent way to achieve the effect of ColorAxis.setColorScale in v 5.0?

Unfortunately, upgrading to v 6.0 would not be an option.

Thanks in advance!

  Re: setColorScale
Posted by Peter Kwan on Jul-25-2019 00:00
Hi FWinds,

In ChartDirector 5.0, you can use ColorAxis.setColorGradient to set the colors along the color axis. The following is an example:

If you want to set the color axis numeric scale, you can use Axis.setLinearScale.

Hope this can help.

Peter Kwan

  Re: setColorScale
Posted by FWinds on Jul-25-2019 18:25
Hi Peter,

Thanks for prompt reply. I actually have in mind a nonlinear scale or actually a piece-wise linear scale such as the attached screenshot (rendered with ChardDirector 6.0):

colorScale = Array(0.3, &HCC00, 0.9, &HFFFF00, 2, &HFFC000, 3, &HFF0000)

I assume this is not possible to replicate with ChartDirector 5.x?

Thanks for your time.

  Re: setColorScale
Posted by Peter Kwan on Jul-25-2019 21:33
Hi FWinds,

Yes, this is possible.

In ChartDirector 5.0, the colors and the numeric scale are always independent. For this effect you need, you may first a color gradient. For example, you can use Windows Paint or a graphics editor to open your attached chart image, then measure the colors in a few equally spaced points along the vertical color axis. This provides a list of colors that you can use to create the gradient using ColorAxis.setColorGradient.

int[] colors = ... a list of colors ...;
layer.colorAxis().setColorGradient(true, colors);

You can should be able to reproduce any gradient by using sufficiently detail list of colors.

One you get the correct colors, you can recreate the scale. For your case, the scale is:

ColorAxis a = layer.colorAxis();
// axis is from 0.3 to 3
a.setLinearScale(0.3, 3, Chart.NoValue);
// labels at 0.3, 0.9. 2. 3
a.addLabel(0.3, "0.3");
a.addLabel(0.9, "0.9");
a.addLabel(2, "2.0");
a.addLabel(3, "3.0");

Hope this can help.

Peter Kwan

hausfrauen porno tube