-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.project | ||
.buildpath | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
Examples/cache/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Tue Jun 14 10:10:34 CEST 2011 | ||
eclipse.preferences.version=1 | ||
include_path= | ||
This comment has been minimized.
Sorry, something went wrong.
stof
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
include_once '../loader.php'; | ||
|
||
use GoogleChartGenerator\Library\BarChart\BarChart; | ||
use GoogleChartGenerator\Library\BarChart\Bar; | ||
|
||
|
||
function getRandomData($size, $min = 0, $max = 100) { | ||
$values = $keys = array(); | ||
for ($i=0; $i < $size; $i++) { | ||
$values[] = rand($min, $max); | ||
$keys[] = $i; | ||
} | ||
return array_combine($keys, $values); | ||
} | ||
|
||
$charts = array(); | ||
|
||
$chart = new BarChart(array('title' => 'Default settings')); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$charts[] = $chart; | ||
|
||
$chart = new BarChart(array('size' => '620x200', 'legend' => true)); | ||
$chart->addData(new Bar(getRandomData(6), array('title' => 'Bar #1'))); | ||
$chart->addData(new Bar(getRandomData(6), array('title' => 'Bar #2'))); | ||
$chart->addData(new Bar(getRandomData(6), array('title' => 'Bar #3'))); | ||
$charts[] = $chart; | ||
|
||
$chart = new BarChart(array('stacked' => true)); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$charts[] = $chart; | ||
|
||
$chart = new BarChart(array('position' => 'horizontal', 'size' => '300x230')); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$charts[] = $chart; | ||
|
||
$chart = new BarChart(array('position' => 'horizontal', 'size' => '300x210')); | ||
$chart->addData(new Bar(getRandomData(3))); | ||
$chart->addData(new Bar(getRandomData(3))); | ||
//$chart->addData(new Bar(getRandomData(6))); | ||
$charts[] = $chart; | ||
|
||
$chart = new BarChart(array('position' => 'horizontal', 'size' => '300x210')); | ||
$chart->setStacked(true); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$chart->addData(new Bar(getRandomData(6))); | ||
$charts[] = $chart; | ||
|
||
include 'view.php'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
|
||
include_once '../loader.php'; | ||
|
||
use GoogleChartGenerator\Library\LineChart\LineChart; | ||
use GoogleChartGenerator\Library\LineChart\Line; | ||
|
||
function getRandomData($size, $min = 0, $max = 100) { | ||
$values = $keys = array(); | ||
for ($i=0; $i < $size; $i++) { | ||
$values[] = rand($min, $max); | ||
$keys[] = $i; | ||
} | ||
return array_combine($keys, $values); | ||
} | ||
|
||
$charts = array(); | ||
|
||
// default settings | ||
$chart = new LineChart(array('title' => 'Default settings')); | ||
$chart->addLine(new Line(getRandomData(20))); | ||
$charts[] = $chart; | ||
|
||
// size, y axis | ||
$chart = new LineChart(array('title' => 'Size, y axis')); | ||
$chart->setSize('500x200'); | ||
$chart->getYAxis()->setMax(150)->setMin(-50); | ||
$line = new Line(array(72.932,74.812,74.436,78.195,66.917,73.308,68.045,66.165,64.286,77.068,65.789,57.895,67.669,64.286,71.429,81.579,85.338,64.662,67.293,75.188,60.902,66.917,74.812,85.338,72.932,73.308,72.556,75.564,75.564,74.812,77.82,78.947,77.444)); | ||
$chart->addLine($line); | ||
$charts[] = $chart; | ||
|
||
// size, more lines, colours, widths | ||
$chart = new LineChart(array('title' => 'Size, more lines, colors, widths')); | ||
$chart->setSize('800x200'); | ||
$chart->getYAxis()->setMax(100); | ||
$chart->setLegend('b'); | ||
$line = new Line(getRandomData(20, 40, 60), array('title' => 'Line #1')); | ||
$line->setWidth(4); | ||
$line2 = new Line(getRandomData(20, 20, 80), array('title' => 'Line #2')); | ||
$line2->setWidth(3); | ||
$line3 = new Line(getRandomData(20, 20, 80), array('title' => 'Line #3')); | ||
$line3->setWidth(2); | ||
$line4 = new Line(getRandomData(20), array('title' => 'grey line')); | ||
$line4->setColour('eeeeee'); | ||
$chart->addLine($line4); | ||
$chart->addLine($line); | ||
$chart->addLine($line2); | ||
$chart->addLine($line3); | ||
try { | ||
$dir = __DIR__ . '/cache'; | ||
if (!is_dir($dir)) { | ||
mkdir($dir); | ||
} | ||
$chart->download($dir . '/' . time() . '.png'); | ||
} catch (Exception $e) { } | ||
$charts[] = $chart; | ||
|
||
// custom x values | ||
$chart = new LineChart(array('legend' => true)); | ||
$chart->addLine(new Line(getRandomData(10, 10, 60), array('title' => 'Line #1'))); | ||
$chart->addLine(new Line(array(4 => 50, 5 => 30, 7 => 30, 8 => 45), array('title' => 'Line #2'))); | ||
$chart->addLine(new Line(array(2 => 50, 3 => 30, 4 => 35, 5 => 45, 6 => 20), array('title' => 'Line #3'))); | ||
$chart->getXAxis()->setMin(0)->setMax(10); | ||
$chart->getYAxis()->setMin(10)->setMax(60); | ||
$charts[] = $chart; | ||
|
||
// sparkline #1 | ||
$chart = new LineChart(); | ||
$chart->setTitle(null); | ||
$chart->setSize('180x120'); | ||
$chart->setSparkline(true); | ||
$chart->addLine(new Line(array(5,6,14,8,11,3,2,29,35,26,40,29,51,60,57,6,2,1), array('color' => '000088'))); | ||
$charts[] = $chart; | ||
|
||
// sparkline #2 | ||
$chart = new LineChart(array('title' => null, 'size' => '180x120', 'sparkline' => true)); | ||
$chart->addLine(new Line(array(5,6,14,8,11,3,2,29,35,26,40,29,51,60,57,6,2,1), array('color' => '880000'))); | ||
$charts[] = $chart; | ||
|
||
// legend position | ||
$chart = new LineChart(array('title' => null, 'size' => '180x120', 'legend' => 'b')); | ||
$chart->addLine(new Line(array(2 => 50, 3 => 30, 4 => 35, 5 => 45, 6 => 20), array('title' => 'hello!'))); | ||
$charts[] = $chart; | ||
|
||
$chart = new LineChart(array('title' => null, 'size' => '180x120'/*, 'legend' => 'b'*/)); | ||
$chart->getXAxis()->setEnabled(false); | ||
$chart->getYAxis()->setEnabled(false); | ||
$chart->addLine(new Line(array(5,24,18,8,11,27,26,29,35,20), array('width' => 3, 'title' => 'blue', 'color' => '0070C0'))); | ||
$chart->addLine(new Line(array(8,11,25,2,29,35,8,40,29,23), array('width' => 3, 'title' => 'orange', 'color' => 'F07200'))); | ||
$charts[] = $chart; | ||
|
||
$chart = new LineChart(array('title' => null, 'size' => '180x120'/*, 'legend' => 'b'*/)); | ||
$chart->getXAxis()->setEnabled(false); | ||
$chart->getYAxis()->setEnabled(false); | ||
$chart->addLine(new Line(array(8,11,25,2,29,35,8,40,29,23), array('width' => 3, 'title' => 'orange', 'color' => 'F07200'))); | ||
$chart->addLine(new Line(array(5,24,18,8,11,27,26,29,35,20), array('width' => 3, 'title' => 'blue', 'color' => '0070C0'))); | ||
$charts[] = $chart; | ||
|
||
// data plain text encoding | ||
$chart = new LineChart(array('title' => 'Plain text encoding')); | ||
$chart->addLine(new Line(getRandomData(20))); | ||
$charts[] = $chart; | ||
|
||
include 'view.php'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
include_once '../loader.php'; | ||
|
||
use GoogleChartGenerator\Library\PieChart\PieChart; | ||
use GoogleChartGenerator\Library\PieChart\Arc; | ||
|
||
$charts = array(); | ||
|
||
$chart = new PieChart(array('title' => 'Default settings')); | ||
$chart->addData(new Arc(40)); | ||
$chart->addData(new Arc(60)); | ||
$chart->addData(new Arc(30)); | ||
$charts[] = $chart; | ||
|
||
$chart = new PieChart(); | ||
$chart->addData(array(new Arc(40), new Arc(60, array('color' => 'BBBBBB')), new Arc(30))); | ||
$chart->setOrientation(0.5); | ||
$charts[] = $chart; | ||
|
||
$chart = new PieChart(array('legend' => true)); | ||
$chart->addData(new Arc(rand(1,30), array('title' => 'Arc #1'))); | ||
$chart->addData(new Arc(rand(1,30), array('title' => 'Arc #2'))); | ||
$chart->addData(new Arc(rand(1,30), array('title' => 'Arc #3'))); | ||
$chart->addData(new Arc(rand(1,30), array('title' => 'Arc #4'))); | ||
$charts[] = $chart; | ||
|
||
$chart = new PieChart(array('legend' => true, '3d' => true)); | ||
for ($i=1; $i < 5; $i++) { | ||
$chart->addData(new Arc(rand(1,30), array('title' => 'Arc #' . $i))); | ||
} | ||
$charts[] = $chart; | ||
|
||
include 'view.php'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
function niceDump($chartUrl) { | ||
$chartUrl = preg_replace('/([\&|\?])(.*)\=/U', '\1<span class="option">\2</span>=', $chartUrl); | ||
return $chartUrl; | ||
} | ||
?> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>GoogleChartGenerator</title> | ||
|
||
<style> | ||
body { padding: 0; margin: 0; } | ||
h1 { font-size: 20px; } | ||
.tabs { width: 100%; } | ||
.tabs > div { padding: 5px; } | ||
.tabs > div pre { border: 1px solid #ddd; border-radius: 3px; padding: 5px; background: #eee; } | ||
span.option { color: green; } | ||
.ui-tabs-hide { display: none; } | ||
</style> | ||
|
||
</head> | ||
<body> | ||
<?php foreach ($charts as $index => $chart) : ?> | ||
<div class="tabs"> | ||
<ul> | ||
<li><a href="#tab-chart<?php echo $index; ?>-image">image</a></li> | ||
<li><a href="#tab-chart<?php echo $index; ?>-url">url</a></li> | ||
<li><a href="#tab-chart<?php echo $index; ?>-data">data</a></li> | ||
<li><a href="#tab-chart<?php echo $index; ?>-options">options</a></li> | ||
</ul> | ||
<div id="tab-chart<?php echo $index; ?>-image"><?php echo $chart->render(); ?></div> | ||
<div id="tab-chart<?php echo $index; ?>-url"><pre><?php echo niceDump($chart->debugUrl()); ?></pre></div> | ||
<div id="tab-chart<?php echo $index; ?>-data"><pre><?php print_r($chart->getData()); ?></pre></div> | ||
<div id="tab-chart<?php echo $index; ?>-options"><pre><?php print_r($chart->getOptions()); ?></pre></div> | ||
</div> | ||
<?php endforeach; ?> | ||
|
||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | ||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script> | ||
|
||
<script type="text/javascript"> | ||
$(function() { | ||
$('.tabs').tabs(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?php | ||
|
||
namespace Bundle\GoogleChartBundle\Library; | ||
namespace GoogleChartGenerator\Library; | ||
|
||
use Bundle\GoogleChartBundle\Library\Font; | ||
use GoogleChartGenerator\Library\Font; | ||
This comment has been minimized.
Sorry, something went wrong.
stof
|
||
|
||
/** | ||
* Class representing an anix, supports chaining | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace GoogleChartGenerator\Library\BarChart; | ||
|
||
use GoogleChartGenerator\Library\DataCollection\SequenceData; | ||
|
||
include_once __DIR__ . '/../DataCollection/SequenceData.php'; | ||
This comment has been minimized.
Sorry, something went wrong.
stof
|
||
|
||
class Bar extends SequenceData { | ||
|
||
|
||
|
||
} |
These folder should be ignored locally, not in the repo as they are specific to your IDE