public function testChts()
 {
     $this->assertEquals($this->chart->hasChts(), false);
     $this->assertEquals($this->chart->computeChts(), '000000,12');
     // setTitleColor()
     $this->chart->setTitleColor('00ff00');
     $this->assertEquals($this->chart->computeChts(), '00ff00,12');
     // setTitleSize()
     $this->chart->setTitleSize('20');
     $this->assertEquals($this->chart->computeChts(), '00ff00,20');
     // chts is null if no title
     $q = $this->chart->getQuery();
     $this->assertEquals(isset($q['chts']), false);
     // title make chts appears
     $this->chart->setTitle('foobar');
     $q = $this->chart->getQuery();
     $this->assertEquals(isset($q['chts']), true);
     $this->assertEquals($q['chts'], '00ff00,20');
 }
Example #2
0
$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;
}