<?php require '../lib/Chart.php'; $chart = new Chart('lc', 500, 200); $chart->setScale(0, 100); $line = new ChartData(array(10, 12, 15, 20, 22, 50, 60, 63, 58, 75, 67, 80)); $chart->addData($line); $y_axis = new ChartAxis('y'); $chart->addAxis($y_axis); $x_axis = new ChartAxis('x'); $chart->addAxis($x_axis); if (isset($_GET['debug'])) { var_dump($chart->getQuery()); echo $chart->validate(); echo $chart->toHtml(); } else { header('Content-Type: image/png'); echo $chart; }
<?php require '../lib/Chart.php'; require '../lib/markers/ChartTextMarker.php'; $values = array(); for ($i = 0; $i <= 10; $i += 1) { $values[] = rand(20, 80); } $chart = new Chart('bvs', 500, 200); $chart->setScale(0, 100); $data = new ChartData($values); $chart->addData($data); $marker = new ChartTextMarker(); $marker->setData($data); $chart->addMarker($marker); header('Content-Type: image/png'); echo $chart;
<?php require '../lib/Chart.php'; require '../lib/markers/ChartLineMarker.php'; require '../lib/markers/ChartShapeMarker.php'; $values = array(array(), array(), array()); for ($i = 0; $i <= 10; $i += 1) { $v = rand(20, 80); $values[0][] = $v; $values[1][] = rand(0, 20); $values[2][] = $v + rand(-10, 10); } $chart = new Chart('bvs', 500, 200); $chart->setScale(0, 100); $data0 = new ChartData($values[0]); $chart->addData($data0); $data1 = new ChartData($values[1]); $data1->setColor(array('FFC6A5', 'FFFF42', 'DEF3BD', '00A5C6', 'DEBDDE')); $chart->addData($data1); $marker = new ChartLineMarker(); $marker->setData($data0); $marker->setSize(5); $marker->setPoints(5); $chart->addMarker($marker); $marker = new ChartLineMarker(); $marker->setData($data0); $marker->setColor('6699cc'); $marker->setSize(5); $marker->setPoints(0, 5); $marker->setZOrder(-0.5); $chart->addMarker($marker);
<?php require '../lib/Chart.php'; $values = array(); for ($i = 0; $i <= 10; $i += 1) { $values[] = rand(10, 100); } $chart = new Chart('bvs', 500, 200); $chart->addData(new ChartData($values)); $y_axis = new ChartAxis('y'); $chart->addAxis($y_axis); header('Content-Type: image/png'); echo $chart;
$cos[] = round(cos($i * M_PI / 180), 2); } $chart = new Chart('lc', 500, 200); $chart->setGridLines(25, 50, 1, 1); $chart->setMargin(30, 50); $chart->setLegendSize(100, 10); $chart->setFill('333333'); $chart->setFill('444444', Chart::CHART_AREA); $chart->setTitle('Sinus & Cosinus'); $chart->setTitleColor('FFFFFF'); $chart->setTitleSize(18); $sin = new ChartData($sin); $sin->setLegend('Sinus'); $sin->setThickness(2); $sin->setColor('D1F2A5'); $chart->addData($sin); $cos = new ChartData($cos); $cos->setLegend('Cosinus'); $cos->setThickness(2); $cos->setColor('F56991'); $chart->addData($cos); $y_axis = new ChartAxis('y'); $y_axis->setDrawLine(false); $y_axis->setRange(-1, 1); $y_axis->setLabelColor('ffffff'); $chart->addAxis($y_axis); $x_axis = new ChartAxis('x'); $x_axis->setDrawLine(false); $x_axis->setRange(0, 360); $x_axis->setLabels(array(0, 90, 180, 270, 360)); $x_axis->setLabelColor('ffffff');