[[PageOutline(2-5,Contents,pullout)]] = Graphs tables and other data using Google Visualization API = == Description == This plugin adds Google Visualization graphs and charts to Trac pages. The most basic usage is graphing an existing report: [[Image(effort.png)]] See more examples [wiki:VisualizationPlugin#Examples below]. == Configuration == 1. Install the plugin (after downloading and unzipping): {{{ cd visualizationplugin/0.12 sudo python setup.py bdist_egg sudo cp dist/TracVisualization*.egg /your/trac/location/plugins/ }}} See [http://trac.edgewall.org/wiki/TracPlugins TracPlugins] for more installation details and options. You'll likely need to restart Trac's web server after installation. 2. Enable the plugin: {{{ [components] viz.* = enabled }}} You can alternatively use the Trac Web Admin GUI to enable any or all rules. 3. Configure which pages to include graphs - example: {{{ [viz] reports = 21 }}} The above example will populate an area chart from the table of data found in report 21 and display the chart above that table - see screenshot above. The examples section [wiki:VisualizationPlugin#Examples below] shows additional ways to include graphs and charts on Trac pages. == Bugs/Feature Requests == Existing bugs and feature requests for VisualizationPlugin are [report:9?COMPONENT=VisualizationPlugin here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=VisualizationPlugin&owner=robguttman new ticket]. == Download == Download the zipped source from [download:visualizationplugin here]. == Source == You can check out VisualizationPlugin from [http://trac-hacks.org/svn/visualizationplugin here] using Subversion, or [source:visualizationplugin browse the source] with Trac. == Examples == === Existing report === The most basic usage is adding a chart to an existing report - this can be achieved with almost no configuration. Simply list the reports in the {{{[viz]}}} section: {{{ [viz] reports = 21,23 }}} The plugin will automatically determine the data types for each column. However, the table needs to be structured suitably for graphing. In the screenshot at the top of this page, the table was built by grouping tickets into weeks as follows (sqlite SQL): {{{ SELECT date(tc.time/1000000, 'unixepoch', 'weekday 5') as "Week ending", SUM(CASE e.value WHEN '' THEN 0 ELSE e.value END) AS effort FROM ticket t JOIN ticket_change tc ON tc.ticket = t.id and tc.field = 'status' and tc.newvalue='closed' and tc.time=(SELECT max(time) from ticket_change tc2 where tc2.ticket = t.id and tc2.field = 'status' and tc2.newvalue='closed') LEFT OUTER JOIN ticket_custom e ON e.ticket = t.id and e.name = 'effort' WHERE resolution = 'fixed' AND t.type != 'epic' GROUP BY date(tc.time/1000000, 'unixepoch', 'weekday 5') ORDER BY date(tc.time/1000000, 'unixepoch', 'weekday 5') }}} If you prefer a column chart instead of the default area chart, you can change the chart type as follows: {{{ [viz] reports = 21,23 type = ColumnChart }}} The type name must exactly match those supported by the Google Visualization API [http://code.google.com/apis/chart/interactive/docs/gallery.html here] (no spaces). You can also customize all of its options available for that chart type. For example, the {{{ColumnChart}}} type's options can be found [http://code.google.com/apis/chart/interactive/docs/gallery/columnchart.html#Configuration_Options here]. So if we wanted to add a title and change the color for the same table as shown in the screen at the top of this page, we can so this: [viz] reports = 21,23 type = ColumnChart options = colors:['green'],title='Whistle while we work' }}} [[Image(whistle.png)]] === Burndown chart on Milestone page === * table * remote == Recent Changes == [[ChangeLog(visualizationplugin, 3)]] == Author/Contributors == '''Author:''' [wiki:robguttman] [[BR]] '''Maintainer:''' [wiki:robguttman] [[BR]] '''Contributors:'''