<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gmodfactions.wiki//index.php?action=history&amp;feed=atom&amp;title=Template%3APie_chart%2Fdoc</id>
	<title>Template:Pie chart/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://gmodfactions.wiki//index.php?action=history&amp;feed=atom&amp;title=Template%3APie_chart%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://gmodfactions.wiki//index.php?title=Template:Pie_chart/doc&amp;action=history"/>
	<updated>2026-06-04T04:02:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://gmodfactions.wiki//index.php?title=Template:Pie_chart/doc&amp;diff=2741&amp;oldid=prev</id>
		<title>2600:1700:A2A0:FB50:EDA3:55E9:337C:A13B at 04:23, 31 October 2023</title>
		<link rel="alternate" type="text/html" href="https://gmodfactions.wiki//index.php?title=Template:Pie_chart/doc&amp;diff=2741&amp;oldid=prev"/>
		<updated>2023-10-31T04:23:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{High-use}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This is a template that draws [[pie chart]]s using a single image, a lot of (inline) CSS code generated by parser functions, and &amp;#039;&amp;#039;absolutely no JavaScript&amp;#039;&amp;#039;. Some details of how it works are given [[#How it works|below]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The labels, values, and colors of up to 30 slices may be specified. All the parameters for six slices are included below; to include more slices, copy the code for one of the others, changing the digit at the end of each parameter name. When making a pie chart, ensure that the segments are ordered by size (largest to smallest) and in a clockwise direction.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;&lt;br /&gt;
{{Pie chart&lt;br /&gt;
| thumb  = &lt;br /&gt;
| radius = &lt;br /&gt;
| caption= &lt;br /&gt;
| footer = &lt;br /&gt;
| label1 = &lt;br /&gt;
| value1 = &lt;br /&gt;
| color1 = &lt;br /&gt;
| label2 = &lt;br /&gt;
| value2 = &lt;br /&gt;
| color2 = &lt;br /&gt;
| label3 = &lt;br /&gt;
| value3 = &lt;br /&gt;
| color3 = &lt;br /&gt;
| label4 = &lt;br /&gt;
| value4 = &lt;br /&gt;
| color4 = &lt;br /&gt;
| label5 = &lt;br /&gt;
| value5 = &lt;br /&gt;
| color5 = &lt;br /&gt;
| label6 = &lt;br /&gt;
| value6 = &lt;br /&gt;
| color6 = &lt;br /&gt;
| other  = &lt;br /&gt;
| other-color = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
{{Pie chart&lt;br /&gt;
| radius = 100&lt;br /&gt;
| PANSKURA MUNICIPALITY LANGUAGES = Default colors&lt;br /&gt;
| BENGALI  = {{gcolor|1}}  | value1 = 91.0&lt;br /&gt;
| HINDI = {{gcolor|2}}  | value2 = 4.2&lt;br /&gt;
| URDU = {{gcolor|3}}  | value3 = 2.3&lt;br /&gt;
| KHORTHA  = {{gcolor|4}}  | value4 = 1.7&lt;br /&gt;
| OTHERS  = {{gcolor|5}}  | value = 0.6&lt;br /&gt;
| &lt;br /&gt;
* {{para|thumb}} specifies which side of the page the chart is floated to and defaults to &amp;lt;code&amp;gt;right&amp;lt;/code&amp;gt;, as with image files. To make the chart appear on the &amp;#039;&amp;#039;left&amp;#039;&amp;#039; side of the page, specify {{para|thumb|left}}.&lt;br /&gt;
* {{para|radius}} specifies the radius of the pie chart in pixels. Do not include a &amp;quot;px&amp;quot; suffix. If omitted, it will default to 100.&lt;br /&gt;
* {{para|caption}} specifies a string of text that appears on a line just before the legend.&lt;br /&gt;
* {{para|footer}} specifies a string of text that appears &amp;#039;&amp;#039;below&amp;#039;&amp;#039; the legend.&lt;br /&gt;
* {{para|other}}, if set equal to any visible string (even &amp;quot;0&amp;quot; or &amp;quot;no&amp;quot;), an &amp;quot;Other&amp;quot; item will appear in the legend, corresponding to the final slice that makes the values add up to 100. (If the total is already over 100, then the &amp;quot;Other&amp;quot; percentage will be negative.)&lt;br /&gt;
* {{para|other-color}} can be used to override the default white color of the &amp;quot;Other&amp;quot; slice.&lt;br /&gt;
* Each {{para|label&amp;#039;&amp;#039;N&amp;#039;&amp;#039;}} is a string of text that appears in the legend entry for a slice. Omitting it will cause a legend entry to not be shown for that slice.&lt;br /&gt;
* Each {{para|value&amp;#039;&amp;#039;N&amp;#039;&amp;#039;}} is the percentage that the slice represents. Do &amp;#039;&amp;#039;not&amp;#039;&amp;#039; include the percent sign (e.g., for eighty percent, use the value &amp;quot;80&amp;quot;, not &amp;quot;80%&amp;quot; or &amp;quot;.80&amp;quot;). Collectively, the values must add to 100 or less (in the latter case, a final slice completes the pie, whether {{para|other}} is specified or not). Also note that each value is shown in the legend exactly as written, without any rounding or other reformatting.&lt;br /&gt;
* Each {{para|color&amp;#039;&amp;#039;N&amp;#039;&amp;#039;}} is a [[Web colors|CSS color code or name]]. If omitted, the default color palette seen in the pie chart to the right is used. If you need to graph more than 14 values (not counting the &amp;quot;Other&amp;quot; slice), then you should specify {{para|color15}} onwards in the template call.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
* Google Chrome and Safari do not appear to [[Spatial anti-aliasing|anti-alias]] borders, so the lines are a bit jagged. (For Chrome, this issue seems to be resolved, as of version 26.)&lt;br /&gt;
* Due to how the graphing is implemented, it is not possible to save a copy of the chart using the browser&amp;#039;s &amp;quot;Save Image&amp;quot; function (however, a [[screenshot]] can be taken).&lt;br /&gt;
* If {{para|other}} is set, the final slice is always labeled as &amp;quot;Other&amp;quot; in the legend. This is not configurable. If you don&amp;#039;t like that, just add to the template call another slice with the appropriate value (to sum to 100) and the desired label, and don&amp;#039;t use {{para|other}}.&lt;br /&gt;
* No labels can be put on the slices themselves.&lt;br /&gt;
* The maximum number of slices that can be displayed is &amp;#039;&amp;#039;&amp;#039;30&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
* Currently the default colors used for slices 15 onwards are all the same as the default color of slice 14.&amp;lt;!-- this can be fixed by adding more cases to Template:Graph color --&amp;gt;&lt;br /&gt;
* If the specified values add to 100 and {{para|other}} is set, the calculated percentage for that slice can sometimes turn out to be very strange (e.g., &amp;quot;1.4210854715202E-14%&amp;quot; instead of &amp;quot;0%&amp;quot;)&amp;lt;!-- this can be fixed by, say, optionally rounding the result to a level of precision specified by a parameter --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{clear right}}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
The following code generates the pie chart shown at right. Note that the default chart size and colors are used, and the value of &amp;quot;1&amp;quot; for the &amp;quot;other&amp;quot; parameter is only used for its &amp;quot;truth value&amp;quot; as a visible string—i.e., to say, yes, we want an &amp;quot;Other&amp;quot; entry in the legend (the same chart would result if &amp;quot;0&amp;quot; were used).&lt;br /&gt;
{{Pie chart&lt;br /&gt;
|value1 = 42&lt;br /&gt;
|label1 = One&lt;br /&gt;
|value2 = 32&lt;br /&gt;
|label2 = Two&lt;br /&gt;
|value3 = 12&lt;br /&gt;
|label3 = Three&lt;br /&gt;
|value4 = 3&lt;br /&gt;
|label4 = Four&lt;br /&gt;
|value5 = 2&lt;br /&gt;
|label5 = Five&lt;br /&gt;
|value6 = 1&lt;br /&gt;
|label6 = Six&lt;br /&gt;
|other = 1&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; style=&amp;quot;overflow:auto&amp;quot;&amp;gt;&lt;br /&gt;
{{Pie chart&lt;br /&gt;
|value1 = 42&lt;br /&gt;
|label1 = One&lt;br /&gt;
|value2 = 32&lt;br /&gt;
|label2 = Two&lt;br /&gt;
|value3 = 12&lt;br /&gt;
|label3 = Three&lt;br /&gt;
|value4 = 3&lt;br /&gt;
|label4 = Four&lt;br /&gt;
|value5 = 2&lt;br /&gt;
|label5 = Five&lt;br /&gt;
|value6 = 1&lt;br /&gt;
|label6 = Six&lt;br /&gt;
|other = 1&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a more real-world example.&lt;br /&gt;
{{Pie chart&lt;br /&gt;
| caption= [[Religion in the Czech Republic]] in 2001.&lt;br /&gt;
| label1 = [[Atheist]]s and [[agnostic]]s&lt;br /&gt;
| value1 = 59&lt;br /&gt;
| color1 = darkgreen&lt;br /&gt;
| label2 = [[Catholic]]s&lt;br /&gt;
| value2 = 26.8&lt;br /&gt;
| color2 = brown&lt;br /&gt;
| label3 = [[Protestant]]s&lt;br /&gt;
| value3 = 2.5&lt;br /&gt;
| color3 = #08f&lt;br /&gt;
| other  = yes&lt;br /&gt;
| other-color = silver&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; style=&amp;quot;overflow:auto&amp;quot;&amp;gt;&lt;br /&gt;
{{Pie chart&lt;br /&gt;
| caption= [[Religion in the Czech Republic]] in 2001.&lt;br /&gt;
| label1 = [[Atheist]]s and [[agnostic]]s&lt;br /&gt;
| value1 = 59&lt;br /&gt;
| color1 = darkgreen&lt;br /&gt;
| label2 = [[Catholic]]s&lt;br /&gt;
| value2 = 26.8&lt;br /&gt;
| color2 = brown&lt;br /&gt;
| label3 = [[Protestant]]s&lt;br /&gt;
| value3 = 2.5&lt;br /&gt;
| color3 = #08f&lt;br /&gt;
| other  = yes&lt;br /&gt;
| other-color = silver&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
This template uses a technique for [http://erezsh.wordpress.com/2008/07/31/drawing-diagonal-lines-with-css/ drawing diagonal lines in CSS] exploiting the fact that borders set on elements are [[miter join]]ed. 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.&lt;br /&gt;
&lt;br /&gt;
Pie slices are drawn in clockwise order in a counterclockwise direction. These pie slices are positioned:&lt;br /&gt;
* Inside a square element of (2 * &amp;lt;i&amp;gt;radius&amp;lt;/i&amp;gt;)x(2 * &amp;lt;i&amp;gt;radius&amp;lt;/i&amp;gt;) pixels&lt;br /&gt;
* with &amp;lt;code&amp;gt;border-radius: &amp;lt;i&amp;gt;radius&amp;lt;/i&amp;gt;px&amp;lt;/code&amp;gt; for a circular shape&lt;br /&gt;
* with a white (or other specified color) background visible in the empty space that occurs if the &amp;quot;other&amp;quot; slice is present&lt;br /&gt;
* and with &amp;lt;code&amp;gt;overflow: hidden;&amp;lt;/code&amp;gt; set.&lt;br /&gt;
This allows only the part of each slice that is inside the circle to be visible on the page.&lt;br /&gt;
&lt;br /&gt;
Most of the code in {{tlx|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.&lt;br /&gt;
{{clear right}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|Brick chart}}&lt;br /&gt;
* {{tl|Composition bar}}&lt;br /&gt;
* [[Module:Chart]]&lt;br /&gt;
&lt;br /&gt;
{{Graph, chart and plot templates}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other|&lt;br /&gt;
| &amp;lt;!-- CATEGORIES BELOW THIS LINE, PLEASE: --&amp;gt;&lt;br /&gt;
[[Category:Chart, diagram and graph formatting and function templates]]&lt;br /&gt;
[[Category:Graph, chart and plot templates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>2600:1700:A2A0:FB50:EDA3:55E9:337C:A13B</name></author>
	</entry>
</feed>