56 | | == Example == |
| 56 | == Examples == |
| 57 | |
| 58 | === Existing report === |
| 59 | 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: |
| 60 | {{{ |
| 61 | [viz] |
| 62 | reports = 21,23 |
| 63 | }}} |
| 64 | |
| 65 | 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): |
| 66 | {{{ |
| 67 | SELECT date(tc.time/1000000, 'unixepoch', 'weekday 5') as "Week ending", |
| 68 | SUM(CASE e.value |
| 69 | WHEN '' THEN 0 |
| 70 | ELSE e.value END) AS effort |
| 71 | FROM ticket t |
| 72 | JOIN ticket_change tc ON tc.ticket = t.id and tc.field = 'status' and tc.newvalue='closed' |
| 73 | and tc.time=(SELECT max(time) from ticket_change tc2 where tc2.ticket = t.id and tc2.field = 'status' and tc2.newvalue='closed') |
| 74 | LEFT OUTER JOIN ticket_custom e ON e.ticket = t.id and e.name = 'effort' |
| 75 | WHERE resolution = 'fixed' AND t.type != 'epic' |
| 76 | GROUP BY date(tc.time/1000000, 'unixepoch', 'weekday 5') |
| 77 | ORDER BY date(tc.time/1000000, 'unixepoch', 'weekday 5') |
| 78 | }}} |
| 79 | |
| 80 | If you prefer a column chart instead of the default area chart, you can change the chart type as follows: |
| 81 | {{{ |
| 82 | [viz] |
| 83 | reports = 21,23 |
| 84 | type = ColumnChart |
| 85 | }}} |
| 86 | |
| 87 | 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: |
| 88 | [viz] |
| 89 | reports = 21,23 |
| 90 | type = ColumnChart |
| 91 | options = colors:['green'],title='Whistle while we work' |
| 92 | }}} |
| 93 | |
| 94 | [[Image(whistle.png)]] |
| 95 | |
| 96 | === Burndown chart on Milestone page === |
| 97 | |
| 98 | |