{
    if ($a === NULL) {
        $a = 0;
    }
    return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);
}
function getPerCent($value)
{
    return sprintf('%.1f', $value) . ' %';
}
$graph = new Graph(450, 400);
$graph->setTiming(TRUE);
$graph->setAntiAliasing(TRUE);
$group = new PlotGroup();
$group->setBackgroundColor(color(80));
$group->setXAxisZero(FALSE);
$group->title->set("Some lines");
$group->title->setBackgroundColor(new Color(255, 255, 255, 25));
$group->title->border->show();
$group->title->setPadding(3, 3, 3, 3);
$group->title->move(0, -15);
$group->setPadding(45, NULL, 45, NULL);
$group->axis->left->setLabelNumber(mt_rand(0, 10));
$group->axis->left->label->setCallbackFunction('getPerCent');
foreach (array('left', 'right') as $axis) {
    $group->axis->{$axis}->setTickStyle(TICK_OUT);
}
foreach (array('top', 'bottom') as $axis) {
    $group->axis->{$axis}->setTickStyle(TICK_OUT);
}
// Set axis title
Пример #2
0
 *
 */
require_once "../../BarPlot.class.php";
function color($a = NULL)
{
    if ($a === NULL) {
        $a = 0;
    }
    return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);
}
$graph = new Graph(400, 400);
$graph->setAntiAliasing(TRUE);
$group = new PlotGroup();
$group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0));
$group->setPadding(40, 40, 25, 25);
$group->setXAxisZero((bool) mt_rand(0, 1));
if (mt_rand(0, 1)) {
    $group->setYMax(0);
}
$group->axis->left->setLabelPrecision(2);
for ($n = 0; $n < 4; $n++) {
    $x = array();
    for ($i = 0; $i < 5; $i++) {
        $x[] = cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5 - 1;
    }
    $plot = new BarPlot($x, $n + 1, 4);
    $plot->barBorder->hide();
    $plot->setBarPadding(0.2, 0.2);
    $plot->barShadow->setSize(4);
    $plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
    $plot->barShadow->setColor(new Color(255, 255, 255, 20));