Template:Pie chart

From IxWiki
Revision as of 15:59, 31 July 2024 by Heku (talk | contribs)
Jump to navigation Jump to search

This is an experimental template that draws pie charts using a single image, a lot of (inline) CSS code generated by parser functions, and absolutely no JavaScript. It uses a technique for drawing diagonal lines in CSS exploiting the fact that borders set on elements are miter joined. Thus, it is possible to set one border to an opaque color, with the others fully transparent, to form a diagonal line. The angle of the line can be controlled by adjusting the widths of two adjacent borders (one of them opaque) relative to each other.

Pie slices are drawn in clockwise order in a counterclockwise direction. These pie slices are positioned:

  • Inside a square element of (2 * radius)x(2 * radius) pixels
  • with border-radius: radiuspx for a circular shape
  • with a white background (visible in the empty space that occurs if the "other" slice is present)
  • and with overflow: hidden; set.

This allows only the part of each slice that is inside the circle to be visible on the page.

Most of the code in {{Pie chart/slice}} is divided into five sections, the first four corresponding to quadrants of the circle and the last to cleanly cover the case in which one slice occupies 100% of the chart.

Example

Religion in the Czech Republic as of 2001.

  Atheists and agnostics (59%)
  Catholics (26.8%)
  Protestants (2.5%)
  Other (11.7%)

The following example of Template:Pie chart generates the pie chart shown at right.

 {{Pie chart
 | caption=[[Religion in the Czech Republic]] as of 2001.
 | other = yes
 | label1 = [[Atheist]]s and [[Agnosticism|agnostics]]
 | value1 = 59 | color1 = silver
 | label2 = [[Catholic Church|Catholics]]
 | value2 = 26.8 | color2 = #008
 | label3 = [[Protestantism|Protestants]]
 | value3 = 2.5 | color3 = #08f
 }}

See also

Formatted/colorized template source for Template:Pie chart

<includeonly> <div class="pie-chart-wrapper"> <div class="PieChartTemplate thumb t{{{thumb|right}}}" {{#if:{{{style|}}}
    |style="{{{style|}}}"}}"> <!-- Graph --> <div style="background-color:white;margin:auto;position:relative;width:{{#expr:2*{{{radius|100}}}}}px;height:{{#expr:2*{{{radius|100}}}}}px;overflow:hidden;border-radius:{{{radius|100}}}px;border:1px solid black"> {{#if:{{{value30|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color30|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}}+{{{value26}}}+{{{value27}}}+{{{value28}}}+{{{value29}}}+{{{value30}}} }}}}}}<!-- -->{{#if:{{{value29|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color29|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}}+{{{value26}}}+{{{value27}}}+{{{value28}}}+{{{value29}}} }}}}}}<!-- -->{{#if:{{{value28|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color28|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}}+{{{value26}}}+{{{value27}}}+{{{value28}}} }}}}}}<!-- -->{{#if:{{{value27|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color27|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}}+{{{value26}}}+{{{value27}}} }}}}}}<!-- -->{{#if:{{{value26|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color26|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}}+{{{value26}}} }}}}}}<!-- -->{{#if:{{{value25|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color25|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}}+{{{value25}}} }}}}}}<!-- -->{{#if:{{{value24|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color24|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}}+{{{value24}}} }}}}}}<!-- -->{{#if:{{{value23|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color23|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}}+{{{value23}}} }}}}}}<!-- -->{{#if:{{{value22|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color22|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}}+{{{value22}}} }}}}}}<!-- -->{{#if:{{{value21|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color21|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}}+{{{value21}}} }}}}}}<!-- -->{{#if:{{{value20|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color20|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}}+{{{value20}}} }}}}}}<!-- -->{{#if:{{{value19|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color19|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}}+{{{value19}}} }}}}}}<!-- -->{{#if:{{{value18|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color18|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}}+{{{value18}}} }}}}}}<!-- -->{{#if:{{{value17|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color17|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}}+{{{value17}}} }}}}}}<!-- -->{{#if:{{{value16|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color16|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}}+{{{value16}}} }}}}}}<!-- -->{{#if:{{{value15|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color15|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}}+{{{value15}}} }}}}}}<!-- -->{{#if:{{{value14|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color14|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}}+{{{value14}}} }}}}}}<!-- -->{{#if:{{{value13|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color13|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}}+{{{value13}}} }}}}}}<!-- -->{{#if:{{{value12|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color12|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}}+{{{value12}}} }}}}}}<!-- -->{{#if:{{{value11|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color11|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}}+{{{value11}}} }}}}}}<!-- -->{{#if:{{{value10|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color10|sienna}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}}+{{{value10}}} }}}}}}<!-- -->{{#if:{{{value9|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color9|purple}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}}+{{{value9}}} }}}}}}<!-- -->{{#if:{{{value8|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color8|orange}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}}+{{{value8}}} }}}}}}<!-- -->{{#if:{{{value7|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color7|brown}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}}+{{{value7}}} }}}}}}<!-- -->{{#if:{{{value6|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color6|aqua}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}}+{{{value6}}} }}}}}}<!-- -->{{#if:{{{value5|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color5|fuchsia}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}}+{{{value5}}} }}}}}}<!-- -->{{#if:{{{value4|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color4|yellow}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}}+{{{value4}}} }}}}}}<!-- -->{{#if:{{{value3|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color3|blue}}}
        |{{#expr: {{{value1}}}+{{{value2}}}+{{{value3}}} }}}}}}<!-- -->{{#if:{{{value2|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color2|green}}}
        |{{#expr: {{{value1}}}+{{{value2}}} }}}}}}<!-- -->{{#if:{{{value1|}}}
    |{{Pie chart/slice|radius={{{radius|100}}}
        |{{{color1|red}}}
        | {{{value1}}} }}}} </div> <!-- Legend --> <div class="thumbcaption"> {{{caption|}}} {{#if:{{{label1|}}}
    |{{legend|{{{color1|red}}}
        |{{{label1}}} ({{{value1}}}%)}} }}{{#if:{{{label2|}}}
    |{{legend|{{{color2|green}}}
        |{{{label2}}} ({{{value2}}}%)}} }}{{#if:{{{label3|}}}
    |{{legend|{{{color3|blue}}}
        |{{{label3}}} ({{{value3}}}%)}} }}{{#if:{{{label4|}}}
    |{{legend|{{{color4|yellow}}}
        |{{{label4}}} ({{{value4}}}%)}} }}{{#if:{{{label5|}}}
    |{{legend|{{{color5|fuchsia}}}
        |{{{label5}}} ({{{value5}}}%)}} }}{{#if:{{{label6|}}}
    |{{legend|{{{color6|aqua}}}
        |{{{label6}}} ({{{value6}}}%)}} }}{{#if:{{{label7|}}}
    |{{legend|{{{color7|<!-- brown --> #a52a2a}}}
        |{{{label7}}} ({{{value7}}}%)}} }}{{#if:{{{label8|}}}
    |{{legend|{{{color8|<!-- orange --> #ffa500}}}
        |{{{label8}}} ({{{value8}}}%)}} }}{{#if:{{{label9|}}}
    |{{legend|{{{color9|purple}}}
        |{{{label9}}} ({{{value9}}}%)}} }}{{#if:{{{label10|}}}
    |{{legend|{{{color10|sienna}}}
        |{{{label10}}} ({{{value10}}}%)}} }}{{#if:{{{label11|}}}
    |{{legend|{{{color11|sienna}}}
        |{{{label11}}} ({{{value11}}}%)}} }}{{#if:{{{label12|}}}
    |{{legend|{{{color12|sienna}}}
        |{{{label12}}} ({{{value12}}}%)}} }}{{#if:{{{label13|}}}
    |{{legend|{{{color13|sienna}}}
        |{{{label13}}} ({{{value13}}}%)}} }}{{#if:{{{label14|}}}
    |{{legend|{{{color14|sienna}}}
        |{{{label14}}} ({{{value14}}}%)}} }}{{#if:{{{label15|}}}
    |{{legend|{{{color15|sienna}}}
        |{{{label15}}} ({{{value15}}}%)}} }}{{#if:{{{label16|}}}
    |{{legend|{{{color16|sienna}}}
        |{{{label16}}} ({{{value16}}}%)}} }}{{#if:{{{label17|}}}
    |{{legend|{{{color17|sienna}}}
        |{{{label17}}} ({{{value17}}}%)}} }}{{#if:{{{label18|}}}
    |{{legend|{{{color18|sienna}}}
        |{{{label18}}} ({{{value18}}}%)}} }}{{#if:{{{label19|}}}
    |{{legend|{{{color19|sienna}}}
        |{{{label19}}} ({{{value19}}}%)}} }}{{#if:{{{label20|}}}
    |{{legend|{{{color20|sienna}}}
        |{{{label20}}} ({{{value20}}}%)}} }}{{#if:{{{label21|}}}
    |{{legend|{{{color21|sienna}}}
        |{{{label21}}} ({{{value21}}}%)}} }}{{#if:{{{label22|}}}
    |{{legend|{{{color22|sienna}}}
        |{{{label22}}} ({{{value22}}}%)}} }}{{#if:{{{label23|}}}
    |{{legend|{{{color23|sienna}}}
        |{{{label23}}} ({{{value23}}}%)}} }}{{#if:{{{label24|}}}
    |{{legend|{{{color24|sienna}}}
        |{{{label24}}} ({{{value24}}}%)}} }}{{#if:{{{label25|}}}
    |{{legend|{{{color25|sienna}}}
        |{{{label25}}} ({{{value25}}}%)}} }}{{#if:{{{label26|}}}
    |{{legend|{{{color26|sienna}}}
        |{{{label26}}} ({{{value26}}}%)}} }}{{#if:{{{label27|}}}
    |{{legend|{{{color27|sienna}}}
        |{{{label27}}} ({{{value27}}}%)}} }}{{#if:{{{label28|}}}
    |{{legend|{{{color28|sienna}}}
        |{{{label28}}} ({{{value28}}}%)}} }}{{#if:{{{label29|}}}
    |{{legend|{{{color29|sienna}}}
        |{{{label29}}} ({{{value29}}}%)}} }}{{#if:{{{label30|}}}
    |{{legend|{{{color30|sienna}}}
        |{{{label30}}} ({{{value30}}}%)}} }}{{#if:{{{other|}}}
    |{{legend|white
        |Other ({{#expr:100-{{{value1|0}}}-{{{value2|0}}}-{{{value3|0}}}-{{{value4|0}}}-{{{value5|0}}}-{{{value6|0}}}-{{{value7|0}}}-{{{value8|0}}}-{{{value9|0}}}-{{{value10|0}}}-{{{value11|0}}}-{{{value12|0}}}-{{{value13|0}}}-{{{value14|0}}}-{{{value15|0}}}-{{{value16|0}}}-{{{value17|0}}}-{{{value18|0}}}-{{{value19|0}}}-{{{value20|0}}}-{{{value21|0}}}-{{{value22|0}}}-{{{value23|0}}}-{{{value24|0}}}-{{{value25|0}}}-{{{value26|0}}}-{{{value27|0}}}-{{{value28|0}}}-{{{value29|0}}}-{{{value30|0}}}}}%)}}}} {{#if:{{{footer|}}}
    |<p style="margin-bottom:0">{{{footer}}}</p>}} </div> </div> </div> </div></div></includeonly><noinclude> {{documentation}} <!-- Add categories to the /doc subpage, interwikis to Wikidata. --> </noinclude>:

Formatted/colorized template source for Template:Pie chart/slice

<includeonly><div style="border:solid transparent;position:absolute;width:{{{radius|100}}}px;line-height:0;{{#switch:{{#expr:floor({{{2}}}/25)}} <!-- 0-25% -->
    |0= left:{{{radius|100}}}px; top:{{#expr:{{{radius|100}}}*(1-sin(pi/50*{{{2}}}))}}px; border-width:0 0 {{#expr:{{{radius|100}}}*sin(pi/50*{{{2}}})}}px {{#expr:{{{radius|100}}}*cos(pi/50*{{{2}}})}}px; border-bottom-color:{{{1}}} "></div> <!-- 25-50% -->
    |1= right:{{{radius|100}}}px; top:0; border-width:0 {{#expr:{{{radius|100}}}*tan(pi/50*({{{2}}}-25))}}px {{{radius|100}}}px 0; border-right-color:{{{1}}} "></div> <div style="position:absolute;line-height:0;border-style:solid;right:0;top:0;border-width:0 {{{radius|100}}}px {{{radius|100}}}px 0;border-color:{{{1}}}"></div> <!-- 50-75% -->
    |2= right:{{{radius|100}}}px; top:{{{radius|100}}}px; border-width:{{#expr:{{{radius|100}}}*sin(pi/50*({{{2}}}-50))}}px {{#expr:{{{radius|100}}}*cos(pi/50*({{{2}}}-50))}}px 0 0; border-top-color:{{{1}}} "></div> <div style="position:absolute;line-height:0;border-style:solid;left:0;top:0;border-width:0 {{#expr:2*{{{radius|100}}}}}px {{{radius|100}}}px 0;border-color:{{{1}}}"></div> <!-- 75%-100% -->
    |3= left:{{{radius|100}}}px; top:{{{radius|100}}}px; border-width:{{{radius|100}}}px 0 0 {{#expr:{{{radius|100}}}*tan(pi/50*({{{2}}}-25))}}px; border-left-color:{{{1}}} "></div> <div style="position:absolute;line-height:0;border-style:solid;left:0;top:0;border-width:0 {{#expr:2*{{{radius|100}}}}}px {{{radius|100}}}px 0;border-color:{{{1}}}"></div> <div style="position:absolute;line-height:0;border-style:solid;left:0;top:0;border-width:0 {{{radius|100}}}px {{#expr:2*{{{radius|100}}}}}px 0;border-color:{{{1}}}"></div> <!-- 100% -->
    |4= left:0; top:0; border-width:0 {{#expr:2*{{{radius|100}}}}}px {{#expr:2*{{{radius|100}}}}}px 0; border-color:{{{1}}} "></div> }}</includeonly><noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>:

Formatted/colorized template source for Template:Legend

<includeonly><!-- --><templatestyles src="Legend/styles.css" /><!-- --><div class="legend"><!-- --><span class="legend-color" style="<!-- -->{{#if:{{{border|}}}
    |border: {{{border}}};
    |{{#if:{{{outline|}}}
        |border: 1px solid {{{outline}}};}}}}<!-- -->{{#if:{{{1|}}}
    |{{greater color contrast ratio|{{{1}}}
        |white
        |black
        |css=y}}}}<!-- -->{{#if:{{{textcolor|}}}
    |color:{{{textcolor}}};}}<!-- -->{{#if:{{{size|}}}
    |font-size:{{{size}}};}}"><!-- -->{{#if:{{{text|}}}{{{alt|}}}
    | <span class="legend-text" style="{{#if:{{{alt|}}}
        |color:{{{1|}}};}}font-family: monospace, monospace;">{{If empty|{{{alt|}}}
        |{{{text|}}}
        | }}</span>
    | }}<!-- --></span><!-- --> {{{2|}}}<!-- --></div><!-- --></includeonly><noinclude> {{Documentation}} </noinclude>:

Formatted/colorized template source for Template:Trim

<includeonly>{{safesubst:#if:1|{{{1|}}}}}</includeonly><noinclude> {{Documentation}} </noinclude>: