|
X-Axis Labels beginning with - |
Posted by SRAY on Sep-01-2012 06:44 |
|
I have discovered an issue with using x-axis labels that begin with a dash. When I do it, the dash is stripped off. How do I get the dash to stay on?
Code example:
@{$DATA{LABELS}} = qw(-10 -9 -8 -7 -6 -4 -29);
$c->xAxis()->setLinearScale(0, $noOfPoints-1, \\@{$DATA{LABELS}});
I check to verify that the array is stored correctly. Also, if I put the dash in themiddle of the label, or use a different special character (like the addition sign) at the start, it works fine. I need to know how to display the dash at the start on the x-axis labels. Thanks for your help. |
Re: X-Axis Labels beginning with - |
Posted by Peter Kwan on Sep-03-2012 21:35 |
|
Hi SRAY,
For setLinearScale2, if the first character of a label is "-", it will be interpreted as meaning associated the labels with a minor tick. (If you look at the labels closely, you can see the "ticks" are shorter than usual. This is easier to see if you include both labels with and without a leading "-" for comparison.) This is described in the documentation for Axis.setLinearScale2.
If you need to display "-" as the first character of a label, you would need to use "\\-" instead.
@{$DATA{LABELS}} = qw(\\-10 \\-9 \\-8 \\-7 \\-6 \\-4 \\-29);
Hope this can help.
Regards
Peter Kwan |
|