Tags:
create new tag
, view all tags

Working with Google Charts

http://code.google.com/apis/chart/

Google Charts lets you create a chart by sending chart drawing parameters in a url. Example:

http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello|World

Generates:

Example with votes

Some people have casted their vote in a topic. Let's take DesireMeter as an example (I've copied the vote table in this topic).

  • Number of votes: 19
  • Average: 6.4

Sure we've got an average. But how many votes have been cast on desire level 10, how many on desire level 9? We will create a graph with a bar for each desire level. For Google Graphs we will normalize each count to 100.

  • Desire Level 1: 20
  • Desire Level 2: 0
  • Desire Level 3: 20
  • Desire Level 4: 10
  • Desire Level 5: 20
  • Desire Level 6: 10
  • Desire Level 7: 10
  • Desire Level 8: 30
  • Desire Level 9: 70
  • Desire Level 10: 0

A couple of drawing variables:

  • Set MAX = 10
  • Set MAIN_COLOR = ffcc66
  • Set SECONDARY_COLOR = eeeecc
  • Set BAR_WIDTH = 10
  • Set GRAPH_WIDTH = 200
  • Set GRAPH_HEIGHT = 170

Generate the url:

http://chart.apis.google.com/chart?cht=bhs&chs=200x170&chd=t:20,0,20,10,20,10,10,30,70,0|80,100,80,90,80,90,90,70,30,100&chco=ffcc66,eeeecc&chbh=10&chxt=x,y&chxl=0:|0|X|1:|10|9|8|7|6|5|4|3|2|1|

Generates:

-- Contributors: ArthurClemens - 09 Dec 2007

Discussion

That's cool..! Would it be tough to add this as an enhancement to the VotePlugin ?

-- KeithHelfrich - 23 Dec 2007

Can we create a common %CHART function that we can then use for several of the new Charting systems that exist? I'd love to be able to compare Flot, Google Charts, Dojo and the Flash based Charting implementations, without having to recode my TWiki topics each time.

I'm Thinking something similar to the ResultSet feature request, with added optional paramters for the implementation specific extras.

see GeneralisedCHARTdefinition

-- SvenDowideit - 29 Dec 2007

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2007-12-29 - SvenDowideit
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.