[[PageOutline(2-5,Contents,pullout)]] = Embed Google Charts in wiki pages == Description This plugin provides a simple way to chart the result of an SQL query using the [https://developers.google.com/chart/?hl=en Google Chart API]. It defines a macro called GChart that can be used to pass variables into for the creation of charts, which are subsequently displayed on your wiki page. === Line chart {{{ [[GChart(query="SELECT id FROM ticket", type="line")]] }}} {{{ #!html }}} '''Note''': the following example macros must be entered in a single line. === Pie chart {{{ [[GChart(type="pie", chs="250x100", query="SELECT rev FROM revision")]] }}} {{{ #!html }}} === Add a legend {{{ [[GChart(chxt="y", chco="ff0000,00ff00,0000ff", chs="300x150", type="lc", chdl="Animals|Vegetables|Minerals", query="SELECT rev, (10+2*rev), (30+3*rev) FROM revision")]] }}} {{{ #!html }}} === Add a fill {{{ [[GChart( chxt="x,y", chf="c,lg,45,ffffff,0,76A4FB,0.75|bg,s,EFEFEF", chco="ff0000", chs="300x150", type="lc", chxl="0:|1|2|3|4|5|1:||50|100", chls="4.0,3.0,0.0", query="SELECT id FROM ticket")]] }}} Equivalent to multi-line macro: {{{ {{{ #!GChart type = "lc", # chart type equivalent to 'cht' chxt = "x,y", chf = "c,lg,45,ffffff,0,76A4FB,0.75|bg,s,EFEFEF", chco = "ff0000", # chart color: blue chs = "300x150", # chart image size chxl = "0:|1|2|3|4|5|1:||50|100", chls = "4.0,3.0,0.0", query = "SELECT id \ FROM ticket" }}} }}} {{{ #!html

}}} See README.txt for more information. '''Note''': This plugin currently uses an eval() statement to turn parameters in Python dict syntax into an actual dictionary. This means you can pass tuples and lists to the engine. However, it is also risky, since you are allowing the author of the wiki page to execute arbitrary Python code. Until this has been replaced by a more limited parser that only accepts primitive types, do not use this plugin in an environment where you don't trust your users. Patches to fix this are welcome! For example, using JSON: install simplejson, then in Python: {{{ >>> args = '["hurray",{"for":"json"}]' >>> import simplejson >>> simplejson.loads(args) ["hurray", {"for":"json"}] }}} == Bugs/Feature Requests Existing bugs and feature requests for GoogleChartPlugin are [report:9?COMPONENT=GoogleChartPlugin here]. If you have any issues, create a [/newticket?component=GoogleChartPlugin new ticket]. [[TicketQuery(component=GoogleChartPlugin&group=type,format=progress)]] == Download Download the zipped source from [export:googlechartplugin here]. == Source You can check out GoogleChartPlugin from [/svn/googlechartplugin here] using Subversion, or [source:googlechartplugin browse the source] with Trac. == Installation General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page. == Recent Changes [[ChangeLog(googlechartplugin, 3)]] == Author/Contributors '''Author:''' [wiki:optilude] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''