Module:Piechart/doc
Appearance
![]() | This is a documentation subpage for Module:Piechart. It may contain usage information, categories and other content that is not part of the original module page. |
Smooth piechart module.
Usage
Draws charts in HTML with an accessible legend (optional). A list of all features is in the "TODO" section of the main `p.pie` function.
Most of the time you should use with a helper template that adds required CSS: {{Piechart}}.
Examples
TBA
Direct functions
In case you want to use without the {{Piechart}} template, you can use this main functions:
{{#invoke:Piechart|pie|json_data|meta=json_options}}
{{#invoke:Piechart|color|number}}
Example of json_data:
[
{ "label": "pie: $v", "color": "wheat", "value": 40 },
{ "label": "cheese pizza $v", "color": "#fc0", "value": 20 },
{ "label": "mixed pizza: $v", "color": "#f60", "value": 20 },
{ "label": "raw pizza $v", "color": "#f30" }
]
- Note that the last value is missing. The last value is optional as long as the values are intended to sum up to 100 (as in 100%).
- Notice
$v
label, this is a formatted number (see `function prepareLabel
`). - Colors are hex or names. Default palette is in shades of green.
Example of meta=json_options:
|meta = {"size":200, "autoscale":false, "legend":true}
All meta options are optional (see `function p.setupOptions
`).
]]
Feature requests
For feature requests and bugs write to me, the author of the piecharte module: Maciej Nux.