Moduł:Piechart/test
Varia
Custom colors
Default colors
Default labels
Custom colors legend
- pie: 40,0%
- cheese pizza 20,0%
- mixed pizza: 20,0%
- raw pizza 20,0%
Color palette
(subject to change)
- 15 (12,5%)
- 14 (11,7%)
- 13 (10,8%)
- 12 (10,0%)
- 11 (9,17%)
- 10 (8,33%)
- 9 (7,50%)
- 8 (6,67%)
- 7 (5,83%)
- 6 (5,00%)
- 5 (4,17%)
- 4 (3,33%)
- 3 (2,50%)
- 2 (1,67%)
- 1 (0,83%)
- 10 (18,2%)
- 9 (16,4%)
- 8 (14,5%)
- 7 (12,7%)
- 6 (10,9%)
- 5 (9,09%)
- 4 (7,27%)
- 3 (5,45%)
- 2 (3,64%)
- 1 (1,82%)
- 9 (20,0%)
- 8 (17,8%)
- 7 (15,6%)
- 6 (13,3%)
- 5 (11,1%)
- 4 (8,89%)
- 3 (6,67%)
- 2 (4,44%)
- 1 (2,22%)
- 8 (22,2%)
- 7 (19,4%)
- 6 (16,7%)
- 5 (13,9%)
- 4 (11,1%)
- 3 (8,33%)
- 2 (5,56%)
- 1 (2,78%)
- 7 (25,0%)
- 6 (21,4%)
- 5 (17,9%)
- 4 (14,3%)
- 3 (10,7%)
- 2 (7,14%)
- 1 (3,57%)
- 6 (28,6%)
- 5 (23,8%)
- 4 (19,0%)
- 3 (14,3%)
- 2 (9,52%)
- 1 (4,76%)
- 5 (33,3%)
- 4 (26,7%)
- 3 (20,0%)
- 2 (13,3%)
- 1 (6,67%)
- 4 (40,0%)
- 3 (30,0%)
- 2 (20,0%)
- 1 (10,0%)
- 3 (50,0%)
- 2 (33,3%)
- 1 (16,7%)
- 2 (66,7%)
- 1 (33,3%)
Legend
{{Piechart| [
{"label": "ciastka", "value": 2, "color":"goldenrod"},
{"label": "napoje", "value": 1, "color":"#ccf"},
{"label": "słodycze", "value": 5, "color":"darkred"},
{"label": "kanapki", "value": 3, "color":"wheat"}
]
|meta={"autoscale":true, "legend":true, "direction":"row|row-reverse|column|column-reverse"}
}}
(border for clarity)
Default
- ciastka: 2 (18,2%)
- napoje: 1 (9,09%)
- słodycze: 5 (45,5%)
- kanapki: 3 (27,3%)
row
- ciastka: 2 (18,2%)
- napoje: 1 (9,09%)
- słodycze: 5 (45,5%)
- kanapki: 3 (27,3%)
row-reverse
- ciastka: 2 (18,2%)
- napoje: 1 (9,09%)
- słodycze: 5 (45,5%)
- kanapki: 3 (27,3%)
column
- ciastka: 2 (18,2%)
- napoje: 1 (9,09%)
- słodycze: 5 (45,5%)
- kanapki: 3 (27,3%)
column-reverse
- ciastka: 2 (18,2%)
- napoje: 1 (9,09%)
- słodycze: 5 (45,5%)
- kanapki: 3 (27,3%)
Generating meta JSON
JSON for metadata is generated from template params. See: function p.parseMetaParams(frame);
{{Piechart|[
{"label": "napoje", "value": 1, "color":"#ccf"},
{"label": "truskawki", "value": 5, "color":"darkred"},
{"label": "kanapki", "value": 3, "color":"wheat"},
]
|autoscale=true
|legend=true|1|on|yes
}}
legend=true
- napoje: 1 (11,1%)
- truskawki: 5 (55,6%)
- kanapki: 3 (33,3%)
legend=1
- napoje: 1 (11,1%)
- truskawki: 5 (55,6%)
- kanapki: 3 (33,3%)
legend=on
- napoje: 1 (11,1%)
- truskawki: 5 (55,6%)
- kanapki: 3 (33,3%)
legend=yes
- napoje: 1 (11,1%)
- truskawki: 5 (55,6%)
- kanapki: 3 (33,3%)
legend=false
legend=[spaces]
legend=bla, bla, bla
Wikitext to text
Limited wikitext parsing in labels (text is used as a title/tooltip). Probably only makes sense to parse links (templates would be non-trivial...).
Caption
Caption is supposed to be shown above labels. Can contain reasonable wikitext. Should probably only be used in floats and such (otherwise should probably add caption above graph).
Meta-caption
{{Piechart| [
{"label": "[[słodycze]]: $v", "value": 5, "color":"darkred"},
{"label": "[[Kanapka|kanapki]]: $v", "value": 3, "color":"wheat"},
{"label": "[[wafel]]ki: $v", "value": 2, "color":"goldenrod"},
{"label": "[[napój|napoje]]: $v", "value": 1, "color":"#ccf"}
]
|meta={
"autoscale": true, "legend": true,
"size": 180,
"width":"min-content",
"caption": "[[Lorem ipsum]] dolor sit ament; H<sub>2</sub>O."
}
}}
Param-caption
For more complex caption, especially with citations.
{{Piechart| [
{"label": "[[słodycze]]: $v", "value": 5, "color":"darkred"},
{"label": "[[Kanapka|kanapki]]: $v", "value": 3, "color":"wheat"},
{"label": "[[wafel]]ki: $v", "value": 2, "color":"goldenrod"},
{"label": "[[napój|napoje]]: $v", "value": 1, "color":"#ccf"}
]
|meta={
"autoscale": true, "legend": true,
"size": 180,
"width":"min-content",
"direction":"column-reverse"
}
|caption = [[Lorem ipsum]] dolor sit ament; H<sub>2</sub>O<ref group="Caption">Test parametru</ref>.
}}
- ↑ Test parametru
Color function
{{#invoke:Piechart|color|1-10}}
{{#invoke:Piechart|color|0/-1}} = last
8
9 (8+last)
| Color | Hex/name |
|---|---|
| • | #1b7837 |
| • | #7fbf7b |
| • | #d9f0d3 |
| • | #762a83 |
| • | #af8dc3 |
| • | #e7d4e8 |
| • | #d73027 |
| • | #fc8d59 |
| • | #fee090 |
| • | #4575b4 |
| • | #91bfdb |
| • | #e0f3f8 |
| last | #fff |
16 (2*8)
17 (2*8 + last)
Errors
Negative values test.
Render
Last
- 2 (20,0%)
- 3 (30,0%)
- 5 (50,0%)
First
- 2 (20,0%)
- 3 (30,0%)
- 5 (50,0%)
Many
- 2 (20,0%)
- 3 (30,0%)
- 5 (50,0%)
Code
Last
{{Piechart|
[{"value": 2}
,{"value": 3}
,{"value": 5}
,{"value": -1}
]
|meta={"autoscale":true,"legend":true}
}}
First
{{Piechart|
[{"value": -1}
,{"value": 2}
,{"value": 3}
,{"value": 5}
]
|meta={"autoscale":true,"legend":true}
}}
Many
{{Piechart|
[{"value": 2}
,{"value": -1}
,{"value": 3}
,{"value": -1}
,{"value": 5}
]
|meta={"autoscale":true,"legend":true}
}}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.