Changes between Version 4 and Version 5 of TracYetAnotherChartMacro


Ignore:
Timestamp:
May 15, 2018, 6:34:09 PM (6 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracYetAnotherChartMacro

    v4 v5  
    33= Creare bar/line/pie charts of query results
    44
     5{{{#!box info
     6'''Notice''': The plugin is at its very infancy (May 2018) so only a fraction of plotly's functionality is supported, parameter syntax may change a bit and error checking is very likely to be improveable.
     7}}}
     8
    59== Description
    610
    7 Create a bar/line/pie chart of an SQL query using the [https://plot.ly/javascript/ plotly.js] JavaScript plotting engine.
     11This macro allows you to create a bar/line/pie chart of an SQL query using the [https://plot.ly/javascript/ plotly.js] JavaScript plotting engine in your Trac wiki pages and ticket pages. Plotly itself is MIT licensed.
    812
    9 The plugin egg contains plotly.js, ie. there are no external web references.
     13The plugin egg contains plotly.js, ie there are no external web references.
    1014
    1115A given wiki page can contain any number of plots.
    1216
    13 The plugin is at its very infancy (May 2018) so only a fraction of plotly's functionality is supported, parameter syntax may change a bit and error checking is very likely to be improveable.
     17Enter the following in your wiki page:
     18
     19{{{
     20[[yachart(id=first; title=Action statuses; query=SELECT status, COUNT(status) FROM ticket WHERE type = 'Action' GROUP BY status)]]
     21}}}
     22
     23This will result in something like this:
     24
     25[[Image(newplot(1).png, border=2)]]
     26
     27Note the use of semicolon as the delimiter character for the macro arguments. This is chosen to avoid ambiguous commas which are common in SQL queries.
     28
     29The query must return two columns. In `line` and `bar` charts, the first column will be used as x-axis data and the second column as y-axis data. In `pie` charts, the columns will be used as labels and values, respectively.
     30
     31In the query, the macro will replace the string `$USER` with the id of the user logged in. This can be used to display "my tickets":
     32
     33[[Image(newplot(2).png, border=2)]]
     34
     35WikiProcessor syntax is supported which may make queries easier to read and write:
     36{{{
     37{{{#!yachart
     38   id=something;
     39   title=something else;
     40   query=SELECT status, COUNT(status)
     41         FROM ticket
     42         WHERE type = 'Action'
     43         GROUP BY status;
     44}}}
     45}}}
     46
     47=== Parameters
     48
     49{{{#!ini
     50id         = dom-name     # The name of the HTML DOM carrying the chart. Mandatory. Must be unique for each macro call on a wiki page
     51title      = title-text   # The headline shown above the chart. Default: blank.
     52chart_type = bar|line|pie # Optional; default: bar
     53query      = sql-query    # Mandatory
     54width      = pixel-width  # Optional; default: 600 pixels
     55height     = pixel-height # Optional: default: 400 pixels
     56}}}
    1457
    1558== !Bugs/Feature Requests
     
    3578General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page.
    3679
    37 == Usage
    38 
    39 {{{
    40 [[yachart(id=first; title=Action statuses; query=SELECT status, COUNT(status) FROM ticket WHERE type = 'Action' GROUP BY status)]]
    41 }}}
    42 
    43 ...will result in something like this:
    44 
    45 [[Image(newplot(1).png, width=300)]]
    46 
    47 === Parameters
    48 
    49 Note the unusual use of semicolon as delimiter character - this is chosen in order to avoid escaping commas in the SQL query
    50 
    51 {{{#!ini
    52 id         = dom-name     # The name of the HTML DOM carrying the chart. Mandatory. Must be unique for each macro call on a wiki page
    53 title      = title-text   # The headline shown above the chart. Default: blank.
    54 chart_type = bar|line|pie # Optional; default: bar
    55 query      = sql-query    # Mandatory
    56 width      = pixel-width  # Optional; default: 600 pixels
    57 height     = pixel-height # Optional: default: 400 pixels
    58 }}}
    59 
    60 The query must return two columns. In `line` and `bar` charts, the first column will be used as x-axis data and the second column as y-axis data. In `pie` charts, the columns will be used as labels and values, respectively.
    61 
    62 In the query, the macro will replace the string `$USER` with the id of the user logged in. This can be used to display "my tickets":
    63 
    64 [[Image(newplot(2).png, width=300)]]
    65 
    66 WikiProcessor syntax is supported which may make queries easier to read (and write):
    67 {{{
    68    {{{#!yachart
    69    id=something;
    70    title=something else;
    71    query=SELECT
    72             status,
    73             COUNT(status)
    74          FROM ticket
    75          WHERE type = 'Action'
    76          GROUP BY status;
    77    }}}
    78 }}}
    79 
    8080== Recent Changes
    8181