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

Message ListMessage List     Post MessagePost Message

  Different measures of y data.
Posted by jasir on Jun-13-2012 03:33
Hello,

I am very new to chartdirector (php), so I appologise for lame question in advance..

I have two data sets - sales and employees, I would like to display barchart with both of
them.

But values are very different (hundreds of milions vs hundreds), so ideally it would be to
have two y-scales.

Is it possible?

Thank you very much...

  Re: Different measures of y data.
Posted by Peter Kwan on Jun-14-2012 00:58
Hi jasir,

I assume you are like to display the two data sets as bars side by side. In this case, you can use assign one of the data sets to a second y-axis. The code is like:

$layer = $c->addBarLayer(Side);

$ds0 = $layer->addDataSet($mySalesData, 0xff0000, "Sales");
$ds1 = $layer->addDataSet($myEmployeesData, 0x0000ff, "Employees");

#data set 1 is assigned to the second y-axis.
$ds1->setUseYAxis2();

You may want to use $c->yAxis->setTitle and $c->yAxis2->setTitle to assign titles to the axes, so the user can know which axis is for which data set.

Hope this can help.

Regards
Peter Kwan

  Re: Different measures of y data.
Posted by jasir on Jun-14-2012 15:38
Hi Peter,

thank you very much, it is working nicely.
And if I would like to combine barchart (sales) + line chart (employees)?

When I create two barLayer and lineLayer, your approach does not seem to work.

Any advice?

Thank you very very much.

  Re: Different measures of y data.
Posted by Peter Kwan on Jun-15-2012 00:12
Hi jasir,

The code is almost the same. For the line layer, you may use:

$layer = $c->addLineLayer($myEmployeesData, 0x0000ff, "Employees");
$layer->setUseYAxis2();

Hope this can help.

Regards
Peter Kwan