function flickr() { $chart = new GoogleChart('lc', 500, 154); $chart->setAutoscale(GoogleChart::AUTOSCALE_VALUES); $chart->setGridLines(0, 50, 3, 2); $chart->setMargin(10); $values = array(34, 18, 21, 70, 53, 39, 39, 30, 13, 15, 4, 8, 5, 8, 4, 8, 44, 16, 16, 3, 10, 7, 5, 20, 20, 28, 44, null); $line = new GoogleChartData($values); $line->setColor('000000'); $line->setThickness(3); $line->setFill('eeeeee'); $chart->addData($line); $m = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); $m->setData($line); $m->setColor('000000'); $m->setSize(7); $m->setBorder(2); $chart->addMarker($m); $values = array_fill(0, sizeof($values) - 2, null); $values[] = 44; $values[] = 34; $line2 = new GoogleChartData($values); $line2->setColor('000000'); $line2->setThickness(3); $line2->setDash(4, 2); $line2->setFill('eeeeee'); $chart->addData($line2); $m = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); $m->setData($line2); $m->setColor('ffffff'); $m->setSize(4); $m->setBorder(4, '000000'); $m->setPoints(-1); $chart->addMarker($m); $y_axis = new GoogleChartAxis('y'); $y_axis->setDrawLine(false); $y_axis->setDrawTickMarks(false); $y_axis->setLabels(array(null, 35, 70)); $y_axis->setFontSize(9); $y_axis->setTickMarks(5); $y_axis->setTickColor('ffffff'); $chart->addAxis($y_axis); $x_axis = new GoogleChartAxis('x'); $x_axis->setDrawLine(false); $x_axis->setLabels(array('27 apr', '04 may', '11 may', '18 may')); $x_axis->setLabelPositions(0, 25.8, 51.8, 77.59999999999999); $x_axis->setTickMarks(5); $x_axis->setFontSize(9); $chart->addAxis($x_axis); return $chart->getUrl(); }
public function testChxs() { $axis = new GoogleChartAxis('x'); $this->assertEquals($axis->computeChxs(1), null); $axis->setLabelColor('ff0000'); $this->assertEquals($axis->computeChxs(1), '1,ff0000'); $axis->setFontSize(12); $this->assertEquals($axis->computeChxs(1), '1,ff0000,12'); $axis->setLabelAlignment(-1); $this->assertEquals($axis->computeChxs(1), '1,ff0000,12,-1'); $axis->setDrawLine(false); $this->assertEquals($axis->computeChxs(1), '1,ff0000,12,-1,t'); $axis->setDrawTickMarks(false); $this->assertEquals($axis->computeChxs(1), '1,ff0000,12,-1,_'); $axis->setTickColor('00ff00'); $this->assertEquals($axis->computeChxs(1), '1,ff0000,12,-1,_,00ff00'); }
$line2->setFill('eeeeee'); $chart->addData($line2); $m = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); $m->setData($line2); $m->setColor('ffffff'); $m->setSize(4); $m->setBorder(4, '000000'); $m->setPoints(-1); $chart->addMarker($m); $y_axis = new GoogleChartAxis('y'); $y_axis->setDrawLine(false); $y_axis->setDrawTickMarks(false); $y_axis->setLabels(array(null, 35, 70)); $y_axis->setFontSize(9); $y_axis->setTickMarks(5); $y_axis->setTickColor('ffffff'); $chart->addAxis($y_axis); $x_axis = new GoogleChartAxis('x'); $x_axis->setDrawLine(false); $x_axis->setLabels(array('27 apr', '04 may', '11 may', '18 may')); $x_axis->setLabelPositions(0, 25.8, 51.8, 77.59999999999999); $x_axis->setTickMarks(5); $x_axis->setFontSize(9); $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;
$chart->addMarker($marker); $marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); $marker->setData($line); $chart->addMarker($marker); $line = new GoogleChartData($values[1]); $line->setDash(2, 2); $line->setColor('6699cc'); $chart->addData($line); $line = new GoogleChartData($values[2]); $line->setLegend('The others'); $line->setColor('ff0000'); $chart->addData($line); $marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); $marker->setData($line); $marker->setColor('ff0000'); $chart->addMarker($marker); $y_axis = new GoogleChartAxis('y'); $chart->addAxis($y_axis); $x_axis = new GoogleChartAxis('x'); $x_axis->setTickMarks(5); $x_axis->setDrawLine(false); $x_axis->setTickColor('ff0000'); $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; }