Chart Macro
This is a XWiki macro, bundled with all the XWiki products by default.
Macro developed by the XWiki Development Team.
This macro cannot currently be downloaded separately.
Macro developed by the XWiki Development Team.
This macro cannot currently be downloaded separately.
Chart Macro
The chart macro generates graphical charts from various data sources.Usage
Currently chart macro supports two types of data sources. Usage of the macro slightly differs from "xdom" mode to "inline" mode: Usage for "xdom" data sources:{{chart source="xdom" type="<type>" params="<params>" title="<title>" height="<height>" width="<width>"/}}{{chart source="inline" type="<type>" params="<params>" title="<title>" height="<height>" width="<width>"}}
// Put your data table definition here.
{{/chart}}Parameters definition
| Name | Optional | Allowed values | Default value | Description |
|---|---|---|---|---|
| type | no | line, area, bar or pie | none | Type of chart to be generated |
| source | yes | xdom or inline | xdom | Type of the data source which provides input for charting. |
| params | yes | string | none | Additional parameters for the data source. This string contains a list of parameter name to value mappings. Available parameter names and values depend on the data source being used (refer examples below). |
| title | yes | string | none | A title string to be used when rendering the chart |
| width | yes | string | 400 | Width of the chart image in pixels |
| height | yes | string | 300 | Height of the chart image in pixels |
Examples
Example for an "xdom" data source chart: An "xdom" data source can be used when you need to draw charts from data tables located anywhere in the wiki. For an example, let's say xwiki:Main.Data wiki page contains the following data table definition:(%id="table1"%)
| |X |Y |Z
|Q1|1.2|3.4|1.3
|Q2|4.5|3.4|2.3
|Q3|1.2|4.5|9.0
|Q4|3.4|1.2|1.2{{chart type="bar" params="document:<document_source_name>;table:table1;range:B2-D5;series:columns;" title="Chart Test" width="320" height="240"/}}{{chart type="bar" params="document:Main.Data;table:table1;range:B2-D5;series:columns;" title="Chart Test" width="320" height="240"/}}- Wiki page: "document:Main.Data;"
- Name of the data table: "table:table1;" (the table must have an id)
- Data range: "range:B2-D5;" (just like you'd select a data range on an excel sheet)
- Orientation: "series:columns;" (defines the x and y axes)
Example for an "inline" data source chart:
See the Syntax Distribution Chart Snippet.