|
No fonts visible on graph |
Posted by Nicolas on Oct-29-2013 23:25 |
|
Hello,
I tested the bar charts but the fonts are not displayed.
Reading the documentation, I saw that he had put the font files in the folder where
libchart.so is installed (/usr/lib/php5/20090626/ in my situation, i'm on Linux Debian)
and so I put the file arial.ttf in the same directory.
I did reload apache2 but nothing changes.
My code :
# The data for the bar chart
$data = array(85, 156, 179.5, 211, 123);
# The labels for the bar chart
$labels = array("Mon", "Tue", "Wed", "Thu", "Fri");
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(600, 500);
# Set the plotarea at (30, 20) and of size 200 x 200 pixels
$c->setPlotArea(30, 20, 550, 450);
# Add a bar chart layer using the given data
$c->addBarLayer($data);
# Set the labels on the x axis.
$c->xAxis->setLabels($labels);
# Output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
Do I forgot something?
Thank you for your help.
See you.
|
Re: No fonts visible on graph |
Posted by Peter Kwan on Oct-29-2013 23:33 |
|
Hi Nicolas,
Note that you should put the "fonts" subdirectory in the directory where libchartdir.so is installed. So you should have a directory called "/usr/lib/php5/20090626/fonts", and it should contain all your font files. If you have arial.ttf, it should be at "/usr/lib/php5/20090626/fonts/arial.ttf".
If this still cannot solve the problem, please try the diagnostic script "cdinfo.php". It will display why the fonts cannot be loaded. Please let me know what is the result.
(Note: Like all sample scripts in ChartDirector, the diagnostic script "cdinfo.php" uses require_once("../lib/phpchartdir.php") to load ChartDirector. If the "phpchartdir.php" is located in some other place, you would need to modify the code to set the correct path to "phpchartdir.php".)
Regards
Peter Kwan |
Re: No fonts visible on graph |
Posted by Nicolas on Oct-29-2013 23:45 |
|
Hi Peter,
The problem is solved, I just created the directory "fonts" in / usr/lib/php5/20090626 and
put in arial.ttf !!!
Thank you very much for your help .
Regards.
Nico. |
|