تفاوت میان نسخه‌های «الگو:نمودار گرد/توضیحات»

حذف اضافات
(←‏See also: ابرابزار)
(حذف اضافات)
 
__NOTOC__
 
=== Usageکاربرد ===
The labels and values 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.
<pre><nowiki>
[[رده:الگو:طرح خطی، چارت سازمانی و طرح]]
}}</includeonly>
 
=== Limitations ===
* '''The template does not render correctly on mobile devices.''' See [http://en.m.wikipedia.org/wiki/{{FULLPAGENAMEE}} this page on the mobile site] and [[User talk:PleaseStand/Archive 4#Pie chart|a user's report of this issue]].
* Minor issues with printing exist. We also need to implement a good fallback for [[WP:Books|Books]].
* The values need to be percentages.
* Google Chrome and Safari do not appear to [[anti-alias]] borders, so the lines are a bit jagged (this issue seems to be resolved, at least for Chrome - tested with version 26).
* No labels can be put on the slices themselves.
* Inherently, it is not possible to save a copy of the chart using the browser's "Save Image" function.
 
=== How it works ===
{{Pie chart
|other = yes
|value1 = 42
|label1 = One
|value2 = 32
|label2 = Two
|value3 = 12
|label3 = Three
|value4 = 3
|label4 = Four
|value5 = 2
|label5 = Five
|value6 = 1
|label6 = Six
}}
 
{{Pie chart
| caption=[[Religion in the Czech Republic]] as of 2001.
| other = yes
| label1 = [[خداناباوری]]s and [[ندانم‌گرایی]]
| value1 = 59
| color1 = silver
| label2 = [[کلیسای کاتولیک|Catholics]]
| value2 = 26.8
| color2 = #008
| label3 = [[پروتستانتیسم|Protestants]]
| value3 = 2.5
| color3 = #08f
}}
 
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 [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.
 
Note that in the legacy browser [[اینترنت اکسپلورر ۶]], applying transparent borders the standard way does not work. A [http://acidmartin.wordpress.com/2008/08/24/emulating-border-color-transparent-in-internet-explorer-6/ workaround] is used in the form of the [[Wikipedia:Catalogue of CSS classes|class]] "transborder", which has been added to [[MediaWiki:Common.css]] to make this template usable.
 
Pie slices are drawn in clockwise order in a counterclockwise direction. These pie slices are positioned:
* Below a [[:File:Circle frame.svg|200x200px image]] having a transparent circle on a light-colored background (same as the background color used for CSS class "thumbinner")
* Inside a container element with <code>overflow: hidden;</code> 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 {{tl|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 ===
The following example of [[Template:Pie_chart]] generates the pie chart show at right.
<code><pre><nowiki>
{{Pie chart
| caption=[[Religion in the Czech Republic]] as of 2001.
| other = yes
| label1 = [[خداناباوری]]s and [[ندانم‌گرایی]]
| value1 = 59 | color1 = silver
| label2 = [[کلیسای کاتولیک|Catholics]]
| value2 = 26.8 | color2 = #008
| label3 = [[پروتستانتیسم|Protestants]]
| value3 = 2.5 | color3 = #08f
}}
</nowiki></pre></code>
 
=== جستارهای وابسته ===
{{طرح خطی، چارت سازمانی و طرح}}
 
{{بالای تاشو|Formatted/colorized template source for Template:Pie chart}}
{{#invoke:FormatTemplate|format}}
{{پایین تاشو}}
{{بالای تاشو|Formatted/colorized template source for Template:Pie chart/slice}}
{{#invoke:FormatTemplate|format|page=Template:Pie chart/slice}}
{{پایین تاشو}}
{{بالای تاشو|Formatted/colorized template source for Template:Legend}}
{{#invoke:FormatTemplate|format|page=Template:Legend}}
{{پایین تاشو}}
{{بالای تاشو|Formatted/colorized template source for Template:Trim}}
{{#invoke:FormatTemplate|format|page=Template:Trim}}
{{پایین تاشو}}
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[رده:الگو:گرافیک]]
 
</includeonly>