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();
}
 /**
  * Line style
  */
 public function testChls()
 {
     $data = new GoogleChartData(array());
     $this->assertEquals($data->computeChls(), $data->getThickness());
     $data->setThickness(5);
     $this->assertEquals($data->getThickness(), '5');
     $this->assertEquals($data->computeChls(), '5');
     $data->setDash(2);
     $this->assertEquals($data->computeChls(), '5,2');
     $data->setDash(2, 3);
     $this->assertEquals($data->computeChls(), '5,2,3');
     $data->setDash(null, 3);
     $this->assertEquals($data->computeChls(), '5');
     $data = new GoogleChartData(array());
     $data->setDash(2, 3);
     $this->assertEquals($data->computeChls(), '2,2,3');
 }
Beispiel #3
0
$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);
$chart->setFill('ffffcc');
$chart->setGradientFill(45, array('cccccc', 'ffffff', 'cccccc'), GoogleChart::CHART_AREA);
$chart->setTitle('Us versus the others.');
$chart->setTitleColor('999999')->setTitleSize(20);
$line = new GoogleChartData($values[0]);
$line->setLegend('Us');
$chart->addData($line);
$marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::X);
$marker->setData($line);
$marker->setColor('6699cc');
$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);