This macro is bundled with all the XWiki products by default.
Macro developed by the XWiki Development Team.
This macro cannot currently be downloaded separately.

Chart Macro

The chart macro creates a PNG/SVG chart using data from a wiki table or another data source. This macro is not so easy to use directly (it has really a lot of parameters) so there is a work-in-progress charting wizard. For more samples see this special page.

Usage

see example

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
typefalsearea, bar, line, pie, time The type of chart
sourcefalsemap The data source used for the table
typefalsetable, object and objectid In the sequel we only consider the more common case of table data sources.
doctruedocument namecurrent documentThe document that contains the source table
table_numbertruenumber0 (first table)The position of the table in the document. Numbering starts at 0 and only radeox tables are counted.
rangetrue* or of the form A4-C7*The part of the table that is charted
decimal_symboltruecharperiod (.)Usually comma (,) or period (.)
ignore_alphatruebooleanfalseWhether all illegal characters in the data are ignored instead of considered errors
has_header_rowtruebooleantrueWhether the first raw is a header and should be used to name series
has_header_columntruebooleantrueWhether the first column is a header and should be used to name series
seriestruecolumns or rowscolumnsWhether the series are organized on rows or on columns
widthtruenumber400The width of the chart in pixels
heighttruenumber300The height of the chart in pixels
border_visibletruebooleanfalse 
anti_aliastruebooleantrueAntialiasing

Entries in italic are possible keys in the preceding map parameter. The maps are semicolon (;) separated sequences of key-value pairs. The key and the value are separated by colon (:). For example "k1:v1;k2:v2;k3:v3" is a map with three entries.

There are a lot of other parameters not used so often.

Example

{table}
Category | Sales ($)
Category 1 | 1000000
Category 2 |  500000
Category 3 |  500000
Total | = sum(B2:B4)
{table}

{chart:source=type:table;range:A1-B4|type=pie|title=pie in the sky}

See more samples here

Result

table.png

pie.png

Version 11.1 last modified by VincentMassol on 19/06/2008 at 21:58

Comments 2

htran8899 | 26.10.2007 at 07:36 PM
the chart example does not work

VincentMassol | 27.10.2007 at 11:22 AM
Huy, I've just tried it on 1.1.1 and it works fine. You need to save the document. Preview doesn't work since the page hasn't been created yet and the chart macro gets data from the page. This is a limitation.

Attachments 2

Image
table.png 1.2
PostedBy: hritcu on 09/12/2007 (14kb )
Image
pie.png 1.2
PostedBy: hritcu on 09/12/2007 (13kb )

Creator: hritcu on 2007/02/08 11:57
This wiki is licensed under a Creative Commons license
1.4.1.10194