Example #1
0
<?php

error_reporting(E_ALL);
include "../PHPChart/Component.php";
include "../PHPChart.php";
include "../PHPChart/AbstractChart.php";
include "../PHPChart/Graph.php";
include "../PHPChart/Graph/Line.php";
include "../PHPChart/Driver.php";
include "../PHPChart/Driver/ImageMagick.php";
include "../PHPChart/Legend.php";
include "../PHPChart/Palette.php";
include "../PHPChart/Palette/Basic.php";
$chart = new PHPChart(600, 400);
$chart->setDriver($d = new PHPChart_Driver_ImageMagick());
$lineChart = new PHPChart_Graph();
$lineChart->setLineFillAlpha(140);
$legend = new PHPChart_Legend($lineChart);
$legend->setFontSize(12);
$chart->setChart($lineChart);
$chart->setLegend($legend);
//$chart->setLegend(new PHPChart_Legend);
$data = array(1 => 1, 2 => 5, 3 => 2, 4 => 5, 5 => 9, 6 => 12);
$line = new PHPChart_Graph_Line("Home");
$lineChart->addLine($line);
$line->appendData($data);
$data = array(11 => 1, 12 => 2, 13 => 5, 14 => 7, 15 => 3, 16 => 2);
$line->appendData($data);
$data = array(1 => 7, 2 => 12, 3 => 6, 4 => 9, 5 => 3, 6 => 10);
$line = new PHPChart_Graph_Line("Away");
$lineChart->addLine($line);
<?php

require "../lib/phpchart.class.php";
$color_var = array("txt_col", "line_col", "bg_color");
$cname = $_GET["type"];
$chart = new PHPChart($cname);
foreach ($_GET as $key => $value) {
    if ($value != "") {
        if (in_array($key, $color_var)) {
            eval('$chart->' . $key . '="#' . $value . '";');
        } else {
            if ($value == 'yes') {
                eval('$chart->' . $key . '=true;');
            } else {
                if ($value == 'no') {
                    eval('$chart->' . $key . '=false;');
                } else {
                    if (is_numeric($value)) {
                        eval('$chart->' . $key . '=' . $value . ';');
                    } else {
                        eval('$chart->' . $key . "='" . $value . "';");
                    }
                }
            }
        }
    }
}
$chart->genChart();
Example #3
0
<?php

error_reporting(E_ALL);
include "../PHPChart/Component.php";
include "../PHPChart.php";
include "../PHPChart/Driver.php";
include "../PHPChart/Driver/ImageMagick.php";
include "../PHPChart/AbstractChart.php";
include "../PHPChart/Pie.php";
include "../PHPChart/Legend.php";
include "../PHPChart/Palette.php";
include "../PHPChart/Palette/Basic.php";
$chart = new PHPChart(400, 200);
$chart->setDriver(new PHPChart_Driver_ImageMagick());
$pie = new PHPChart_Pie();
$legend = new PHPChart_Legend($pie);
$legend->setFontSize(12);
$chart->setChart($pie);
$chart->setLegend($legend);
$sets = array(array('label' => 'A', 'value' => 23, 'color' => '#ff0000'), array('label' => 'B', 'value' => 62, 'color' => '#0ff000'), array('label' => 'C', 'value' => 76, 'color' => '#00ff00'), array('label' => 'D', 'value' => 54, 'color' => '#000ff0'));
$pie->setData($sets);
$chart->setChart($pie);
echo $chart->render();