<?php require '../lib/GoogleChart.php'; $sin = array(); $cos = array(); for ($i = 0; $i <= 360; $i += 10) { $sin[] = round(sin($i * M_PI / 180), 2); $cos[] = round(cos($i * M_PI / 180), 2); } $chart = new GoogleChart('lc', 500, 200); $chart->setGridLines(25, 50, 1, 1); $chart->setMargin(30, 50); $chart->setLegendSize(100, 10); $chart->setFill('333333'); $chart->setFill('444444', GoogleChart::CHART_AREA); $chart->setTitle('Sinus & Cosinus'); $chart->setTitleColor('FFFFFF'); $chart->setTitleSize(18); $sin = new GoogleChartData($sin); $sin->setLegend('Sinus'); $sin->setThickness(2); $sin->setColor('D1F2A5'); $chart->addData($sin); $cos = new GoogleChartData($cos); $cos->setLegend('Cosinus'); $cos->setThickness(2); $cos->setColor('F56991'); $chart->addData($cos); $y_axis = new GoogleChartAxis('y'); $y_axis->setDrawLine(false); $y_axis->setRange(-1, 1);
<?php require '../lib/GoogleChart.php'; require '../lib/markers/GoogleChartShapeMarker.php'; $chart = new GoogleChart('lc', 800, 154); $chart->setAutoscale(GoogleChart::AUTOSCALE_VALUES); $chart->setGridLines(0, 50, 3, 2); $chart->setMargin(5); $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);
function sin_cos() { $sin = array(); $cos = array(); for ($i = 0; $i <= 360; $i += 10) { $sin[] = round(sin($i * M_PI / 180), 2); $cos[] = round(cos($i * M_PI / 180), 2); } $chart = new GoogleChart('lc', 500, 200); $chart->setGridLines(25, 50, 1, 1); $chart->setMargin(30, 50); $chart->setLegendSize(100, 10); $chart->setFill('333333'); $chart->setFill('444444', GoogleChart::CHART_AREA); $chart->setTitle('Sinus & Cosinus'); $chart->setTitleColor('FFFFFF'); $chart->setTitleSize(18); $sin = new GoogleChartData($sin); $sin->setLegend('Sinus'); $sin->setThickness(2); $sin->setColor('D1F2A5'); $chart->addData($sin); $cos = new GoogleChartData($cos); $cos->setLegend('Cosinus'); $cos->setThickness(2); $cos->setColor('F56991'); $chart->addData($cos); $y_axis = new GoogleChartAxis('y'); $y_axis->setDrawLine(false); $y_axis->setRange(-1, 1); $y_axis->setLabelColor('ffffff'); $chart->addAxis($y_axis); $x_axis = new GoogleChartAxis('x'); $x_axis->setDrawLine(false); $x_axis->setRange(0, 360); $x_axis->setLabels(array(0, 90, 180, 270, 360)); $x_axis->setLabelColor('ffffff'); $chart->addAxis($x_axis); return $chart->getUrl(); }