|
Aligning multi-line Y-axis title |
Posted by Serge on Jan-27-2014 23:37 |
|
Hi,
I don't seem to find a way to align multi-line titles properly for the Y-axis.
To demonstrate the issue, let's modify the 'multibar.php' sample as follows.
// give more space to the titles
OLD: $c->setPlotArea(50, 25, 320, 180, 0xffffc0, 0xffffe0);
NEW: $c->setPlotArea(60, 25, 320, 160, 0xffffc0, 0xffffe0);
// change the Y-axis title to 2 lines
OLD: $c->yAxis->setTitle("Throughput (MBytes Per Hour)");
NEW: $c->yAxis->setTitle("Throughput\\n(MBytes Per Hour)");
// add a title to X-axis
NEW: $c->xAxis->setTitle("Another\\nmultiline title");
This produces a chart as per 'image1.png'
As you can see each line of the X-axis title is Center-aligned. However the lines of the Y-axis title have different alignment. They are Right- (or Top-) aligned?
And I want them to be Center-aligned as well.
I've tried calling setAlignment(Center) - but it produced an overlapping title (see image2.png)
I've also tried calling Axis.setTitlePos(Center) - no luck either.
Serge
|
Re: Aligning multi-line Y-axis title |
Posted by Peter Kwan on Jan-28-2014 01:36 |
|
Hi Serge,
You may use:
$c->yAxis->setTitle("<*block,halign=center*>Throughput\\n(MBytes Per Hour)");
Hope this can help.
Regards
Peter Kwan |
Re: Aligning multi-line Y-axis title |
Posted by Serge on Jan-28-2014 03:40 |
|
Many thanks, Peter. |
|