googleChart plugin |
| Written by kksou | |||
| Thursday, 10 December 2009 | |||
|
This plugin allows you to easily add pie charts, bar graphs, line charts, etc. right inside your content item or article. The charts are created using the Google Chart API. Unique Features
Chart TypesThe Google Chart API provides many different types of charts. However, if you take a look at the API documentation, each chart has its own set of syntax for data, labels, range, grid lines, etc. It gets quite confusing at times, especially with the very cryptic way of naming the parameters. In this plugin, I've selected some of the most commonly-used functions and give them a simpler and easier-to-remember parameter names. As this needs to be coded one by one, below are the list of charts that I've implemented to date. If you want other chart types, you can still access the entire Google Chart APIs using the Raw Mode.
{googleChart type=p width=200 height=100
data="10,20,30,40" label="Jan|Feb|Mar|Apr"}
{googleChart type=p3 width=250 height=100
data="10,20,30,40" label="Jan|Feb|Mar|Apr"}
{googleChart type=bvg width=250 height=100
data="10,40,60,90" label="Jan|Feb|Mar|Apr"}
{googleChart type=bvg width=250 height=100
data="40,10,60,90|20,60,80,100"
label="Jan|Feb|Mar|Apr" color="4D89D9,C6D9FD"}
{googleChart type=bvs width=250 height=100
data="40,10,60,90|20,60,30,10"
label="Jan|Feb|Mar|Apr" color="4D89D9,C6D9FD"}
{googleChart type=bhg width=250 height=128 data="10,40,60,90" label="Jan|Feb|Mar|Apr"}
{googleChart type=bhg width=250 height=250
data="40,10,60,90|20,60,80,100"
label="Jan|Feb|Mar|Apr" color="4D89D9,C6D9FD"}
{googleChart type=bhs width=250 height=128
data="40,10,60,90|20,60,30,10"
label="Jan|Feb|Mar|Apr" color="4D89D9,C6D9FD"}
{googleChart type=lc width=250 height=100
data="10,40,60,90" label="Jan|Feb|Mar|Apr"}
{googleChart type=lc width=250 height=100
data="10,40,60,90" label="Jan|Feb|Mar|Apr" color="4D89D9,C6D9FD"}
How to use
{googleChart type=p3 width=250 height=100
data="12,21,31" label="Label1|Label2|Label3"}
Parameters
For 2D pie charts, you can start with {googleChart type=p width=200 height=100
data="10,20,30,40" label="Jan|Feb|Mar|Apr"}
For 3D pie charts, you can try {googleChart type=p3 width=250 height=100
data="10,20,30,40" label="Jan|Feb|Mar|Apr"}
The largest possible area for all charts except maps is 300,000 pixels. As the maximum height or width is 1000 pixels, examples of maximum sizes are 1000x300, 300x1000, 600x500, 500x600, 800x375, and 375x800. For maps, the maximum size is 440 pixels wide by 220 pixels high. For pie charts, bar graphs and line charts, labels are specified simply by delimiting each label with the vertical bar (|). Note that for pie charts, the Google Chart API does not provide automatic display of data values in percentages. If you want to display the percentages, you have to manual input them in the labels as follows:
{googleChart type=p3 width=360 height=100
data="12,21,31"
label="Label1 (19%)|Label2 (33%)|Label3 (48%)"}
{googleChart type=bvg width=250 height=100
data="1,3,8,9" label="Jan|Feb|Mar|Apr"}
To set the range of the y-value, use the following, where 0 is the minimum y-value, and 10 is the maximum y-value: {googleChart type=bvg width=250 height=100
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,10"}
{googleChart type=bvg width=250 height=100
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,20,5"}
It's similar for horizontal pie chart: {googleChart type=bhg width=250 height=150
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,20,5"}
{googleChart type=bvg width=250 height=100
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,20,5,1"}
It's similar for horizontal pie chart: {googleChart type=bhg width=250 height=150
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,20,5,1"}
{googleChart type=bvg width=250 height=100
data="1,3,8,9" label="Jan|Feb|Mar|Apr" range="0,20,5,1"
color="66ff66"}
For charts such as the grouped bar chart, the colors for each chart are delimited by commas, as shown below: {googleChart type=bvg width=250 height=100
data="40,30,60,90|20,21,42,78" label="Jan|Feb|Mar|Apr"
range="0,100,20,1" color="66ff66,ff6699"}
For pie charts, if you specify 2 or more colors, Google will span colors across these colors as shown below: {googleChart type=p3 width=250 height=100
data="72,48,32,10,6,3" label="Jan|Feb|Mar|Apr|May|Jun"
color="FF3366,33CCFF,3366FF"}
{googleChart type=bvg width=250 height=100
data="40,30,60,90|20,21,42,78" label="2006|2007|2008|2009"
range="0,100,20,1" color="66ff66,ff6699"
legend="Sales|Profit"}
And this one floats to the left. Tag used:
Important: To break away from the float, use the following: {googleChart br=1}
Raw ModeFor power users, you can enter Google Chart APIs in raw mode so that you can tap onto 100% of the Google Chart APIs as provided Google. For example:
{googleChart raw="cht=pc&chd=s:Helo,Wrld&chs=200x100"}
{googleChart raw="cht=v&chs=200×100&chd=t:100,80,60,30,30,30,10"}
{googleChart raw="cht=lc&chd=s:2gounjqLaCf&chco=008000
&chls=2.0,4.0,1.0&chs=250x150&chxt=x&chxl=0:||c|d|a|o|s|v|V|x||&
chm=a,990066,0,3.0,9.0|c,FF0000,0,1.0,20.0|d,80C65A,0,2.0,20.0|
o,FF9900,0,4.0,12.0|s,3399CC,0,5.0,11.0|v,BBCCED,0,6.0,1.0|
V,3399CC,0,7.0,1.0|x,FFCC33,0,8.0,20.0|h,000000,0,0.30,0.5
&chma=0,0,30,0"}
Be a SponsorIf you find this plugin useful, Secure Payments by PayPal. DownloadRemove the "Powered by" linksYou may not edit or remove any copyright or Powered by statements in the googleChart plugin. However, if you find the plugin useful and would like to use the plugin without the "Powered-by" links, you may do so by purchasing a "Powered-by" removal license for only USD $10 per site. Secured payment is processed by 2checkout.com. All major credit cards are accepted, including Visa, Mastercard and American Express, etc. You can also pay by PayPal. Once the transaction is completed, you will be given a link to download the registered version with the "Powered by" links removed. User reviews There are no user reviews yet. Note: You have to be a registered member to leave a comment. Free registration here. |
|||
| < Prev | Next > |
|---|
Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla Plugins
Joomla Components
Joomla Gadgets
- Google Image Search
- Google News Search
- Wikipedia Search
- Google Book Search
- Google Video Search
- Google Currency Converter - AJAX version
- Yahoo Currency Converter - AJAX version
- Yahoo Stock Quote (AJAX module version)
- Yahoo Stock Quote (AJAX component/ module version)
- googleSearch_cse component
- googleSearch_cse module
- googleMaps plugin





