This example adds disclaimer text to the bottom of the plot. (2012-03-23)
Reference: Discussion forum thread
~~~~
:::php
<?php
require_once 'phplot.php';
define('DISCLAIMER_FONT', 'LiberationSans-Italic');
define('STD_DISCLAIMER',
"This plot is not the proprietary information of anybody in particular.
©2012 Nobody Owns This
Unauthorized use and reproduction is encouraged, but pointless.");
function annotate($img, $plot)
{
$text_color = imagecolorresolve($img, 0xff, 0x66, 0x66);
$plot->DrawText('', 0, 400, 595, $text_color, STD_DISCLAIMER,
'center', 'bottom');
}
$data = array(array('', 0, 0, 0), array('', 5, 10, 30));
$plot = new PHPlot(800, 600);
$plot->SetTitle('Plot With Annotation');
$plot->SetXTitle('This is the X Axis');
$plot->SetYTitle('This is the Y Axis');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetPlotType('lines');
$plot->SetPlotAreaWorld(0, 0);
$plot->SetMarginsPixels(NULL, NULL, NULL, 100);
$plot->SetCallback('draw_all', 'annotate', $plot);
$plot->SetFontTTF('generic', DISCLAIMER_FONT, 12);
$plot->DrawGraph();
~~~~~