Template:Pie

From Darkan
Jump to navigation Jump to search

[view] [edit] [purge] Template documentation

This documentation is transcluded from Template:Pie/doc.

With the {{Pie}} template, you can create pie graphs using CSS3 styles. This is currently not supported by Internet Explorer versions 8 and lower, and some older versions of other browsers. Because of the lack of support by those browsers, please do not use this template in mainspace.

The template does not have any security for using too little or too much space, which may cause some parts to overlap, or it may create a gap in the pie. The template is limited to 20 slices, and if there is a slice larger than 180° (50%), it must be the first slice, as the other slices do not support sizes of larger than 180°.

The template can be resized to any size by setting the size to an amount (without px, so |size=200 instead of |size=200px). 200px is the default size.

The template has a legend below it by default. This can be disabled by adding |legend=no. It is advised to add a manual legend to it then though, to make clear what the slices mean.

The template does not work when there is no total amount set with the tot parameter (default is 360). The sizes of the slices are in the unnamed parameters. The first parameter defines the first slice's size, the second defines the second's size, etc. An example is:

{{Pie|size=250|legend=no|tot=100|22|18|15|13|10|8|5|4|3|2}}

this will result in:


The seperate slices can be described in the legend below, by adding |l<n>=description, for example, describing the 2nd slice is done by |l2=Description. Also, it is possible to add an optional legend header, with the lh parameter. For example:

{{Pie|size=250|tot=100|22|18|15|13|10|8|5|4|3|2|lh=Monster drops|l1=Cakes|l2=Runes|l3=Buckets|l4=Bananas|l5=Cabbages|l6=Swords|l7=Bows|l8=Staves|l9=Party hats|l10=Santa hats}}

this will result in:

Monster drops

Cakes
Runes
Buckets
Bananas
Cabbages
Swords
Bows
Staves
Party hats
Santa hats