forked from segy/GoogleChart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
34 lines (26 loc) · 1.23 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
GoogleChart helper for easy generating image charts using Google Chart API
Description later... see examples. I developed it for the purposes I needed now (bar and pie charts), so you may find many options missing. I will add them if I will need them in next project so please be patient or fork and contribute. Enjoy.
This plugin is for CakePHP 2.x
Short example:
Controller:
public $helpers = array('GoogleChart.GoogleChart');
View:
// example of bar chart
echo $this->GoogleChart->create()
->setType('bar', array('horizontal', 'grouped'))
->setSize(500, 400)
->setMargins(5, 5, 5, 5)
->addData(array(1200.48, 432.3, 647.21, 635.2))
->addMarker('value', array('format' => 'f1', 'placement' => 'c'))
->addData(array(20, 42.3, 65.21, 95.2))
->addMarker('value', array('size' => 14, 'color' => '000000'))
->addAxis('x', array('labels' => array('jan 2012', 'feb 2012')))
->addAxis('y', array('axis_or_tick' => 'l', 'size' => 12));
// example of pie chart
echo $this->GoogleChart->create()
->setTitle('CHART TITLE', array('size' => 14, 'color' => '000000'))
->setType('pie', array('3d'))
->setSize(600, 300)
->setMargins(10, 10, 10, 10)
->addData(array(20, 35, 50, 10))
->setPieChartLabels(array('first', 'second', 'third', 'and so on...'));