예제 #1
0
파일: img.php 프로젝트: timh5/gChartPhp
<?php

require_once __DIR__ . "/gchart/gChartInit.php";
$lineChart = new gchart\gLineChart($_GET['width'], $_GET['height']);
$lineChart->addDataSet(array(120, 131, 135, 160, 129, 22, 190));
$lineChart->setLegend(array('Nice figures'));
$lineChart->setColors(array('ED237A'));
$lineChart->setVisibleAxes(array('x', 'y'));
$lineChart->setDataRange(0, 200);
$lineChart->setLegendPosition('t');
// axisnr, from, to, step
$lineChart->addAxisRange(0, 0, 28, 7);
$lineChart->addAxisRange(1, 0, 200);
$lineChart->setGridLines(25, 10);
$lineChart->renderImage($_GET['post']);
 function getYearGraph()
 {
     $output = "<h3>Yearly Contributions</h3>";
     $authors = authorstatsReadJSON();
     $authors = $authors["authors"];
     if (!$authors) {
         return "There are no stats to output!";
     }
     $totalpm = array();
     $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
     for ($i = 0; $i < 12; $i++) {
         array_push($totalpm, $this->_getMonthlyContrib($authors, date("Y") . sprintf("%02s", $i)));
     }
     $lineChart = new gchart\gLineChart(800, 300);
     $lineChart->addDataSet($totalpm);
     $lineChart->setVisibleAxes(array('x', 'x', 'y', 'y'));
     $lineChart->setColors(array("000000"));
     $lineChart->addAxisLabel(0, $months);
     $lineChart->addAxisLabel(1, array("Months"));
     $lineChart->addAxisLabel(3, array("Contributions"));
     $lineChart->addAxisRange(0, 0, 12);
     $lineChart->addAxisRange(1, 0, 100);
     $lineChart->addAxisRange(2, 0, max($totalpm));
     $lineChart->addAxisRange(3, 0, 100);
     $lineChart->addAxisLabelPositions(0, range(1, 12));
     $lineChart->addAxisLabelPositions(1, 50);
     $lineChart->addAxisLabelPositions(3, 50);
     // Append the parameters for the Axes Titles
     return $output . "<img src=\"" . $lineChart->getUrl() . "\">";
 }
예제 #3
0
 public function actionRenderChart()
 {
     Yii::setPathOfAlias('gchart', Yii::getPathOfAlias('application.vendors.gchart'));
     $lineChart = new gchart\gLineChart(200, 200);
     $lineChart->addDataSet(array(120, 131, 135, 160, 129, 22, 190));
     $lineChart->setLegend(array('Nice figures'));
     $lineChart->setColors(array('ED237A'));
     $lineChart->setVisibleAxes(array('x', 'y'));
     $lineChart->setDataRange(0, 200);
     $lineChart->setLegendPosition('t');
     // axisnr, from, to, step
     $lineChart->addAxisRange(0, 0, 28, 7);
     $lineChart->addAxisRange(1, 0, 200);
     $lineChart->setGridLines(25, 10);
     $lineChart->renderImage(true);
     //$lineChart->renderImage(false)
 }