Changes between Version 32 and Version 33 of VisualizationPlugin
- Timestamp:
- Mar 19, 2015, 6:50:04 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
VisualizationPlugin
v32 v33 1 1 [[PageOutline(2-5,Contents,pullout)]] 2 2 3 = Graphs tables and other data using Google Visualization API =3 = Graphs tables and other data using Google Visualization API 4 4 5 == Description ==5 == Description 6 6 7 This plugin adds [http://code.google.com/apis/chart/ Google Visualization API] charts to Trac pages. 7 This plugin adds [http://code.google.com/apis/chart/ Google Visualization API] charts to Trac pages. The most basic usage is graphing an existing report: 8 8 9 9 [[Image(effort.png, border=1)]] … … 13 13 See also: [http://pypi.python.org/pypi/TracGViz TracGViz plugin] 14 14 15 == Configuration == 16 1. Install the plugin (after downloading and unzipping): 15 == Bugs/Feature Requests 16 17 Existing bugs and feature requests for VisualizationPlugin are 18 [report:9?COMPONENT=VisualizationPlugin here]. 19 20 If you have any issues, create a 21 [http://trac-hacks.org/newticket?component=VisualizationPlugin&owner=robguttman new ticket]. 22 23 [[TicketQuery(component=VisualizationPlugin&group=type,format=progress)]] 24 25 == Download 26 27 Download the zipped source from [download:visualizationplugin here]. 28 29 == Source 30 31 You can check out VisualizationPlugin from [http://trac-hacks.org/svn/visualizationplugin here] using Subversion, or [source:visualizationplugin browse the source] with Trac. 32 33 == Installation and Configuration 34 35 1. Install the plugin after downloading and unzipping: 17 36 {{{ 18 37 #!sh … … 22 41 }}} 23 42 24 See [http://trac.edgewall.org/wiki/TracPlugins TracPlugins] for more installation details and options. 43 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. 25 44 26 2. Enable the plugin :45 2. Enable the plugin in `trac.ini`: 27 46 {{{ 28 47 #!ini … … 33 52 You can alternatively use the Trac Web Admin GUI to enable any or all rules. 34 53 35 3. Configure which pages to include graphs - example:54 3. Configure which pages to include graphs in `trac.ini`: 36 55 {{{ 37 56 #!ini … … 40 59 }}} 41 60 42 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.61 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. 43 62 44 This plugin requires Javascript but does not require any other libs to be pre-installed. 63 This plugin requires Javascript but does not require any other libs to be pre-installed. The Google Visualization libs are loaded dynamically using Google's standard JS loader. 45 64 65 == Examples 46 66 47 == Bugs/Feature Requests ==67 === Existing report 48 68 49 Existing bugs and feature requests for VisualizationPlugin are 50 [report:9?COMPONENT=VisualizationPlugin here]. 51 52 If you have any issues, create a 53 [http://trac-hacks.org/newticket?component=VisualizationPlugin&owner=robguttman new ticket]. 54 55 == Download == 56 57 Download the zipped source from [download:visualizationplugin here]. 58 59 == Source == 60 61 You can check out VisualizationPlugin from [http://trac-hacks.org/svn/visualizationplugin here] using Subversion, or [source:visualizationplugin browse the source] with Trac. 62 63 == Examples == 64 65 === Existing report === 66 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 in {{{trac.ini}}}: 69 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 in {{{trac.ini}}}: 67 70 {{{ 68 71 #!ini … … 71 74 }}} 72 75 73 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):76 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): 74 77 {{{ 75 78 #!sql … … 89 92 }}} 90 93 91 The above is only for illustration purposes.Any SQL query can be used as long as it produces a graphable table.94 The above is for illustrative purposes only. Any SQL query can be used as long as it produces a graphable table. 92 95 93 96 If you prefer a column chart instead of the default area chart, you can change the chart type as follows: … … 99 102 }}} 100 103 101 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 do this:104 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 do this: 102 105 {{{ 103 106 #!ini … … 110 113 [[Image(whistle.png)]] 111 114 112 === Different graphs per report === 113 If you use multiple graphs and charts, you may want to customize them differently for different reports. To do that, create a new section for the reports instead of including them in the main {{{[viz]}}} section's {{{reports}}} option: 115 === Different graphs per report 116 117 If you use multiple graphs and charts, you may want to customize them differently for different reports. To do that, create a new section for the reports instead of including them in the main {{{[viz]}}} section's {{{reports}}} option in `trac.ini`: 114 118 {{{ 115 119 #!ini … … 126 130 }}} 127 131 128 You customize a page's graph by creating a section that matches all or part of its url after a {{{viz.}}} prefix. So for example, the above customizes reports 21 and 23 differently. Report 21 will be a green column chart with the given title, and report 23 will be a red area chart with its given title.Both charts will inherit the {{{[viz]}}} section's width and height, however.132 You customize a page's graph by creating a section that matches all or part of its url after a {{{viz.}}} prefix. So for example, the above customizes reports 21 and 23 differently. Report 21 will be a green column chart with the given title, and report 23 will be a red area chart with its given title. Both charts will inherit the {{{[viz]}}} section's width and height, however. 129 133 130 '''Important''': whereas the {{{options}}} option ''adds'' to the base {{{[viz]}}} section's {{{options}}}, all other options (e.g., {{{type}}})''override'' the base {{{[viz]}}} section's options.134 '''Important''': whereas the {{{options}}} option ''adds'' to the base {{{[viz]}}} section's {{{options}}}, all other options, such as {{{type}}}, ''override'' the base {{{[viz]}}} section's options. 131 135 132 === Burndown chart on milestone pages === 133 In the examples above, the data for the charts came from a report table located on the same page. You can also create charts by [http://code.google.com/apis/chart/interactive/docs/queries.html querying remote data sources] that conform to the [http://code.google.com/apis/chart/interactive/docs/dev/implementing_data_source.html Google Visualization Data Source API]. One such example is the [wiki:SumStatsPlugin SumStats plugin] which provides a data source amenable to graphing as a daily burndown chart on any milestone page. For example: 136 === Burndown chart on milestone pages 137 138 In the examples above, the data for the charts came from a report table located on the same page. You can also create charts by [http://code.google.com/apis/chart/interactive/docs/queries.html querying remote data sources] that conform to the [http://code.google.com/apis/chart/interactive/docs/dev/implementing_data_source.html Google Visualization Data Source API]. One such example is the [wiki:SumStatsPlugin SumStats plugin] which provides a data source amenable to graphing as a daily burndown chart on any milestone page. For example: 134 139 {{{ 135 140 #!ini … … 146 151 [[Image(burndown.png)]] 147 152 148 In the configuration above, the {{{source}}} specifies the data source (in this case the local sumstats plugin) and the {{{selector}}} specifies the DOM element where the graph should be inserted before (in this case just before the stats drilldown section).You can position graphs anywhere by specifying an appropriate jQuery selector.153 In the configuration above, the {{{source}}} specifies the data source (in this case the local sumstats plugin) and the {{{selector}}} specifies the DOM element where the graph should be inserted before, in this case just before the stats drilldown section. You can position graphs anywhere by specifying an appropriate jQuery selector. 149 154 150 See the [wiki:SumStatsPlugin SumStats plugin] for details on how to configure it for alternative visualizations (e.g., by adding a {{{query}}} to specify the columns to return and their order).155 See the [wiki:SumStatsPlugin SumStats plugin] for details on how to configure it for alternative visualizations, for example by adding a {{{query}}} to specify the columns to return and their order. 151 156 152 === Any graph on any page === 153 As described above, you can add a graph or chart to any Trac page including wiki pages. The steps are: 154 1. Create a {{{[viz.<page-url>]}}} section in {{{trac.ini}}} 155 1. Set its {{{source}}} option to the remote data source url 156 1. (Optional) Add a {{{query}}} option as appropriate for the data source 157 1. Set the {{{selector}}} to the DOM location before which the graph should be inserted 158 1. Configure the chart {{{type}}} and {{{options}}} as desired 157 === Any graph on any page 159 158 160 To embed iGoogle Gadgets in wiki pages using WikiFormatting, you may wish to try [http://pypi.python.org/pypi/TracGViz TracGViz plugin] (I have not yet tried this myself). 159 As described above, you can add a graph or chart to any Trac page including wiki pages. The steps are: 160 1. Create a {{{[viz.<page-url>]}}} section in {{{trac.ini}}}. 161 1. Set its {{{source}}} option to the remote data source url. 162 1. (Optional) Add a {{{query}}} option as appropriate for the data source. 163 1. Set the {{{selector}}} to the DOM location before which the graph should be inserted. 164 1. Configure the chart {{{type}}} and {{{options}}} as desired. 161 165 162 == Recent Changes == 166 To embed iGoogle Gadgets in wiki pages using WikiFormatting, you may wish to try [http://pypi.python.org/pypi/TracGViz TracGViz plugin] (untested). 167 168 == Recent Changes 163 169 164 170 [[ChangeLog(visualizationplugin, 3)]] 165 171 166 == Author/Contributors ==172 == Author/Contributors 167 173 168 174 '''Author:''' [wiki:robguttman] [[BR]] 169 '''Maintainer:''' [ wiki:robguttman] [[BR]]175 '''Maintainer:''' [[Maintainer]] [[BR]] 170 176 '''Contributors:'''