English Français Deutsch Italiano Dansk Español

Namespace:Charts

Sofawiki includes charts from Chartist.js.

Charts are used as an output option of the Query function. The columns have to be ordered like this:

There are bar charts, line charts and pie charts. You can customize the look with options. See the Chartist API documentation directly for the available options.

The syntax for the output option is

OUTPUT CHART (BAR|LINE|PIE} Options?

where options are in JSON style without the outer curly braces.

The charts are rendered in Javascript as SVG, which can be fully styled. There is a generic stylesheet inc/skin/chartist.css and an adpatation for SofaWiki inc/skin/chartist.wiki.css. If you provide a file site/skin/chartist.css, it will be included.

Example

Data

town first second other
Bern 105000 80000 40000
Genf 240000 250000 160000
Zürich 400000 300000 360000
Lausanne 140000 200000 190000

Simple bar chart

SELECT town, first, second, other WHERE town !0
OUTPUT CHART BAR

Horizontal stacked bar chart

OUTPUT CHART BAR stackBars: true

Line chart

OUTPUT CHART LINE

Dot chart

OUTPUT CHART LINE showLine: false

Note: Still works with categories. You cannot have a x-y dot cloud.

Bar chart

OUTPUT CHART PIE