Google Charts and Graphs
I am going to start posting tutorials and tips on our blog for your benefit of upcoming features for Deki Wiki 1.8.3.
The tutorial today is about the Google Charts and Graphs Deki Wiki extension.
Google Charts and graphs allow you to take comma separated values and display them in a variety of different ways.
Line Chart
The Line Chart script allows you to insert values into the following script to have a line chart display on your page:
{{ google.linechart( … ) }}
The line chart has the following values that can be changed:
- Width and height ex: 400, 200
- Chart values – This is the dataset that you want to plot on the chart ex: [[10,20,30,50,40],[40,50,30,20,10]]
- Legends (optional) – This is what you can name the data sets ex: ['fake','real']
- Colors (optional) – These are the colors of the lines ex: [ 'ff0000', '0000ff' ]
Here are the above example values inserted into the script.
{{ google.linechart(400, 200, [ [ 10, 20, 30, 50, 40 ], [ 40, 50, 30, 20, 10 ] ], [ 'fake', 'real' ], [ 'ff0000', '0000ff' ]) }}
This is what it looks like:
Bar Charts
If you want your data to be displayed as a bar chart then we will swap out the linechart in the beginning of the script with barchart
Also you can toggle with the horizonal/vertical aspect of the chart along with if the bars are next to each other or stacked using true and false values.
true,true = Vertical and stacked
true,false = Vertical and next to each other
false, true = Horizontal and stacked
false, false = Horizontal and next to each other
Here are examples of the barchart scripts with sample images below.
{{ google.barchart(400, 200, [ [ 10, 20, 30, 50, 40 ], [ 40, 50, 30, 20, 10 ] ], [ 'fake', 'real' ], [ 'ff0000', '0000ff' ], true, false) }}
{{ google.barchart(400, 200, [ [ 10, 20, 30, 50, 40 ], [ 40, 50, 30, 20, 10 ] ], [ 'fake', 'real' ], [ 'ff0000', '0000ff' ], false, true) }}
Pie Charts
Piecharts are a little different because it only requires one dataset and the last parameter is a boolean: True means that the pie chart will display in 3D and False means it will be displayed in 2D. Here are the values that are different:
labels (optional) – This is the same as Legend in Line and Bar chart ex: [ 'you', 'him', 'me' ]
colors (optional) – These are the colors of the lines (I use _ to keep the default colors)
threed (optional) – draw 3D chart default: true
Below are sample scripts with sample images below them.
{{ google.piechart(400, 200, [ 10, 20, 30 ], [ 'you', 'him', 'me' ], _, true) }}
{{ google.piechart(400, 200, [ 10, 20, 30 ], [ 'you', 'him', 'me' ], _, false) }}
The Google Charts integration allows you to create pages that include dynamic charts that pertain to the content on the page, allowing you to create professional looking wiki pages for projects or presentations. Deki Wiki has numerous extensions that allow you to create dynamic pages that improve the visual appearance of your content. Let me know what other extensions you would like to see samples for.







Dec 11th, 2007 at 4:55 pm
Awesome!
But is it necessary to develop deki script for an API that is URL encoded?
Dec 11th, 2007 at 5:18 pm
You’re correct that Google charts are just URIs. So technically you can insert them using our image dialog. However, building the correct URIs can be tricky. For instance, the URI for the 3D piechart looks like this:
http://chart.apis.google.com/chart?chs=400×200&cht=p3&chd=t:33.33,66.67,100&chl=you+%7chim%7cme
I would argue that the dekiscript equivalent is more readable and easier to change when needed than the raw URI, wouldn’t you?
Dec 11th, 2007 at 10:12 pm
We should give an example here that is a mashup of something with the Google Charts and Graphs.
Dec 11th, 2007 at 11:18 pm
We should give an example of a mashup with Google Charts and Graphs.
Dec 12th, 2007 at 12:14 am
Nice! hmm.. can this extension also be used to pull data from a database table or spreadsheet?
Dec 12th, 2007 at 4:45 pm
This extension can’t, but you can use other extensions to do this. Keep in mind, the acceptable data for Google Charts and Graphs is pretty limited. I’ll post more about this in a moment.
Dec 12th, 2007 at 5:03 pm
[...] an example mashup of Google Charts with some data store using DekiScript in Deki Wiki to compliment Corey’s previous blog post. We spoke about it for about 2 minutes this morning. A few minutes ago Steve showed me [...]
Dec 13th, 2007 at 5:47 pm
My GUI for the charts API is at Google Charts. Thanks!
Dec 13th, 2007 at 6:51 pm
Impressive and useful.
Pity that extension is not yet enabled on the Wik.is version
. Found out after a while trying to find what I was doing wrong.
Looking forward to it.
Best regards,
Miguel
Dec 13th, 2007 at 10:09 pm
Miguel,
Wik.is is running 1.8.2. This is 1.8.3. You can only check out this source code from SVN. Check out this post: http://www.mindtouch.com/blog/2007/12/12/google-charts-and-graphs-redux-with-a-mashup/
Dec 24th, 2007 at 8:29 am
My GUI: http://charts.hohli.com – Online Charts Builder based on this API
Jan 6th, 2008 at 6:02 pm
Here’s our effort of a really loosely coupled Google API chart wrapper class for PHP:
http://www.talkphp.com/script-giveaway/1704-googlecharts.html
Sep 11th, 2010 at 3:09 pm
Sweet Post!