Moduł:Piechart/test

Varia

Custom colors

Default colors

Default labels

Custom colors legend

  1. pie: 40,0%
  2. cheese pizza 20,0%
  3. mixed pizza: 20,0%
  4. raw pizza 20,0%

Color palette

(subject to change)

  1. 15 (12,5%)
  2. 14 (11,7%)
  3. 13 (10,8%)
  4. 12 (10,0%)
  5. 11 (9,17%)
  6. 10 (8,33%)
  7. 9 (7,50%)
  8. 8 (6,67%)
  9. 7 (5,83%)
  10. 6 (5,00%)
  11. 5 (4,17%)
  12. 4 (3,33%)
  13. 3 (2,50%)
  14. 2 (1,67%)
  15. 1 (0,83%)
  1. 10 (18,2%)
  2. 9 (16,4%)
  3. 8 (14,5%)
  4. 7 (12,7%)
  5. 6 (10,9%)
  6. 5 (9,09%)
  7. 4 (7,27%)
  8. 3 (5,45%)
  9. 2 (3,64%)
  10. 1 (1,82%)
  1. 9 (20,0%)
  2. 8 (17,8%)
  3. 7 (15,6%)
  4. 6 (13,3%)
  5. 5 (11,1%)
  6. 4 (8,89%)
  7. 3 (6,67%)
  8. 2 (4,44%)
  9. 1 (2,22%)
  1. 8 (22,2%)
  2. 7 (19,4%)
  3. 6 (16,7%)
  4. 5 (13,9%)
  5. 4 (11,1%)
  6. 3 (8,33%)
  7. 2 (5,56%)
  8. 1 (2,78%)
  1. 7 (25,0%)
  2. 6 (21,4%)
  3. 5 (17,9%)
  4. 4 (14,3%)
  5. 3 (10,7%)
  6. 2 (7,14%)
  7. 1 (3,57%)
  1. 6 (28,6%)
  2. 5 (23,8%)
  3. 4 (19,0%)
  4. 3 (14,3%)
  5. 2 (9,52%)
  6. 1 (4,76%)
  1. 5 (33,3%)
  2. 4 (26,7%)
  3. 3 (20,0%)
  4. 2 (13,3%)
  5. 1 (6,67%)
  1. 4 (40,0%)
  2. 3 (30,0%)
  3. 2 (20,0%)
  4. 1 (10,0%)
  1. 3 (50,0%)
  2. 2 (33,3%)
  3. 1 (16,7%)
  1. 2 (66,7%)
  2. 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

  1. ciastka: 2 (18,2%)
  2. napoje: 1 (9,09%)
  3. słodycze: 5 (45,5%)
  4. kanapki: 3 (27,3%)

row

  1. ciastka: 2 (18,2%)
  2. napoje: 1 (9,09%)
  3. słodycze: 5 (45,5%)
  4. kanapki: 3 (27,3%)

row-reverse

  1. ciastka: 2 (18,2%)
  2. napoje: 1 (9,09%)
  3. słodycze: 5 (45,5%)
  4. kanapki: 3 (27,3%)

column

  1. ciastka: 2 (18,2%)
  2. napoje: 1 (9,09%)
  3. słodycze: 5 (45,5%)
  4. kanapki: 3 (27,3%)

column-reverse

  1. ciastka: 2 (18,2%)
  2. napoje: 1 (9,09%)
  3. słodycze: 5 (45,5%)
  4. 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

  1. napoje: 1 (11,1%)
  2. truskawki: 5 (55,6%)
  3. kanapki: 3 (33,3%)

legend=1

  1. napoje: 1 (11,1%)
  2. truskawki: 5 (55,6%)
  3. kanapki: 3 (33,3%)

legend=on

  1. napoje: 1 (11,1%)
  2. truskawki: 5 (55,6%)
  3. kanapki: 3 (33,3%)

legend=yes

  1. napoje: 1 (11,1%)
  2. truskawki: 5 (55,6%)
  3. 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...).

  1. słodycze: 5 (45,5%)
  2. kanapki: 3 (27,3%)
  3. wafelki: 2 (18,2%)
  4. napoje: 1 (9,09%)

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

Lorem ipsum dolor sit ament; H2O.
  1. słodycze: 5 (45,5%)
  2. kanapki: 3 (27,3%)
  3. wafelki: 2 (18,2%)
  4. napoje: 1 (9,09%)
{{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.

Lorem ipsum dolor sit ament; H2O[Caption 1].
  1. słodycze: 5 (45,5%)
  2. kanapki: 3 (27,3%)
  3. wafelki: 2 (18,2%)
  4. napoje: 1 (9,09%)
{{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>.
}}



  1. 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

  1. 2 (20,0%)
  2. 3 (30,0%)
  3. 5 (50,0%)

First

  1. 2 (20,0%)
  2. 3 (30,0%)
  3. 5 (50,0%)

Many

  1. 2 (20,0%)
  2. 3 (30,0%)
  3. 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.

  1. 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:
  2. 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.
  3. 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.
  4. 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.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
Kembali kehalaman sebelumnya