|
Unicode Chars and Axis overlapping |
Posted by Jorge Eduardo on Jan-27-2016 02:05 |
|
Hi Peter:
I have two issues. Actually I'm using ChartDirector PHP v-5 on a Debian Machine:
1) How do I print on my graph axis some unicode symbols? For example I need to name and
axis like "RPM U+2B49 " or "RPM ⭉". My intention is to show a UNICODE symbol,
instead of plain text, first one in the unicode number, second is Html-code.
2) I added a layer to place some textboxes over a scatter chart, however I noticed that
the x and y axis overlaps the textoxes. Is there a depth method or arrange method to
solve this? I need textboixes to be on top of the grid and axis, and also need the symbol
to be on top of all, the grid and the textox. I placed an image.
Thanks, have a nice day in Hong Kong.
Jorge.
|
Re: Unicode Chars and Axis overlapping |
Posted by Peter Kwan on Jan-28-2016 02:56 |
|
Hi Jorge
Yes, you can use Unicode characters in ChartDirector. The Unicode characters can be
included in the text string in UTF 8 format. For example, the unicode charactere
U+2B49, when represented in UTF8, is E2 AD 89. In PHP text string syntax, it is then:
"RPM \\xE2\\xAD\\x89"
There are many web sites online which can translate from one kind of unicode transfer
encoding to the other. For your reference, the one I used is:
http://www.endmemo.com/unicode/unicodeconverter.php
Apart from including the unicode in the text string, you would also need to use a font
that has your character. Note that in many ChartDirector sample code, the Arial font is
used, but if your are using Linux, your computer may not have the Arial font. You may
refer to the following page on how to install additional fonts and make them available to
ChartDirector:
http://www.advsofteng.com/doc/cdphp.htm#fontspec.htm
Regarding the text boxes overlapping with the axis, for your case, if the text box is
large enough and close enough to the axis, it can potentially overlap with the axis and
the axis labels. If the text box is in front of the labels, then the labels will be invisible
and if there are sufficient number of text boxes, all the labels or the entire axis would
be invisible. That's why in ChartDirector, the axis is placed in front of the layers.
For your case, you may consider to add a sufficiently large margin between the axis and
the layer plotting region, or to extend the axis scale, so that the text box cannot overlap
with the axis.
It seems due to how the labels are positioned, it is only possible for a label to overlap
with the bottom x-axis. Also, as your y-axis is log scale, the bottom scale (y = 2400 in
your chart) it can extend indefinitely without reaching 0 (since log scale cannot reach 0).
So I think extending the y-axis scale is a good method. If your axis is automatically
scaled by ChartDirector, you may try:
$c->yAxis->setAutoScale(0.05, 0.2, 0.8);
The above code will ensure the y-axis is extended so that no data point can fall within
the bottom 20% of the y-axis.
If you just want to add a margin to the y-axis, you may try:
// add 20 pixel margin at the bottom of the y-axis
$c->yAxis->setMargin(0, 20);
Hope this can help.
Regards
Peter Kwan |
|