|
How to make spaces differ between the ticks for both axises |
Posted by Youssef on Aug-14-2009 15:29 |
|
Hi Peter,
How would I make the spaces differ between the ticks for both axises,
I'm gonna $dataX and $dataY arrays of 5 elements, I want to make the cell on 5x5 the biggest ... and 1x1 cell the smallest.
it will be helpful if there is an example I can look at.
Thank you |
Re: How to make spaces differ between the ticks for both axises |
Posted by Peter Kwan on Aug-14-2009 23:16 |
|
Hi Yorssef,
First, create an axis with no label/tick. Then use Axis.addLabel to add labels or ticks to anywhere you want.
For example, to add ticks at x = 1, 3, 7, 16, 21, the code is (in PHP):
#assume you want to the x-axis scale to be 1 - 21
$c->xAxis->setLinearScale2(1, 21, array());
$xTicks = array(1, 3, 7, 16, 21);
for ($i = 0; $i < count($xTicks); ++$i)
$c->xAxis->addLabel($i, $i);
The same can be applied to the y-axis.
Hope this can help.
Regards
Peter Kwan |
Re: How to make spaces differ between the ticks for both axises |
Posted by Youssef on Aug-15-2009 06:04 |
|
Peter,
thank you for your suggestion, it worked like a charm.
I only had to change the addLabel first argument to $xTicks[$i] instead of $i:
$xTicks = array(1, 3, 7, 16, 21);
for ($i = 0; $i < count($xTicks); ++$i)
$c->xAxis->addLabel($xTicks[$i], $i);
best regards |
|