1#AmCharts Plugin for DokuWiki#
2
3The `amcharts` plugin for DokuWiki makes it easy to insert interactive data charts rendered by [amcharts.js](http://www.amcharts.com/).
4
5This plugin accepts the same JavaScript object that AmCharts takes to generate a chart. Any chart describable by a static JavaScript object is supported. All types of charts natively supported by AmCharts can be rendered.
6
7## Installation ##
8The latest ZIP package of this plugin can be downloaded [here](https://github.com/35niavlys/dokuwiki-plugin-amcharts/archive/master.zip).
9
10If you install this plugin manually, make sure it is installed in `lib/plugins/amcharts/` - if the folder is called different it may not work.
11
12Please refer to the [DokuWiki document](http://www.dokuwiki.org/plugins) for additional info on how to install plugins in DokuWiki.
13
14## Usage ##
15This plugin accepts the same JavaScript object that the `makeChart()` function of amcharts.js takes to render a chart. To include a chart in your DokuWiki page, simply wrap such a JavaScript object with a `<amchart>` tag.
16
17To render a pie chart for exemple:
18```
19<amchart>
20{
21  "type": "pie",
22  "dataProvider": [ {
23    "country": "Lithuania",
24    "litres": 501.9
25  }, {
26    "country": "Czech Republic",
27    "litres": 301.9
28  }, {
29    "country": "Ireland",
30    "litres": 201.1
31  }, {
32    "country": "Germany",
33    "litres": 165.8
34  }, {
35    "country": "Australia",
36    "litres": 139.9
37  }, {
38    "country": "Austria",
39    "litres": 128.3
40  }, {
41    "country": "UK",
42    "litres": 99
43  }, {
44    "country": "Belgium",
45    "litres": 60
46  }, {
47    "country": "The Netherlands",
48    "litres": 50
49  } ],
50  "valueField": "litres",
51  "titleField": "country",
52   "balloon":{
53   "fixedPosition":true
54  }
55}
56</amchart>
57```
58
59Also note that you can include comments in the snippet, both styles (`//` and `/* */`) are supported.
60
61The major restriction is that the JavaScript object must be **static**, i.e. it cannot include function calls or function expressions, for security reasons.
62
63## Options ##
64The `<amchart>` tag can carry optional attributes to customize the appearance of the chart. The attributes are separated by spaces, each specified in the format of `name=value`. Valid attributes are:
65
66| Name     | Description |
67|:--------:|:----------- |
68| `width`  | Width of the chart, specified in CSS format, e.g. 50% or 320px. |
69| `height` | Height of the chart, in the same format as `width`. |
70| `align`  | Chart alignment, can be `left`, `right` or `center`. |
71
72For instance to make your chart occupying half width of its container and floated to the right:
73```
74<amchart align="right" width=50% >
75  {
76    ...
77  }
78</amchart>
79```
80
81## Thanks ##
82This plugin is based on [dokuwiki-plugin-c3chart](https://github.com/jasonxxu/dokuwiki-plugin-c3chart) created by @jasonxxu, thanks to him.
83
84## License ##
85Copyright (C) Sylvain Menu
86
87This program is free software; you can redistribute it and/or modify
88it under the terms of the GNU General Public License as published by
89the Free Software Foundation; version 2 of the License
90
91This program is distributed in the hope that it will be useful,
92but WITHOUT ANY WARRANTY; without even the implied warranty of
93MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
94GNU General Public License for more details.
95
96See the COPYING file in your DokuWiki folder for details
97