Vikipediya, ochiq ensiklopediya
Documentation icon Andoza hujjati[koʻrib chiqish] [tahrirlash] [tarix] [yangilash]

Ishlatilishi[manbasini tahrirlash]

30 tilimgacha bo'lgan yorliqlar va qiymatlar ko'rsatilishi mumkin. Oltita bo'lak uchun barcha parametrlar quyida keltirilgan; ko'proq bo'laklarni kiritish uchun har bir parametr nomining oxiridagi raqamni o'zgartirib, boshqalaridan biriga kodni nusxalash.

| radius = 100
| thumb = 
| caption = 
| other = 
| label1 =remember 
| value1 =16.6
| color1 =2
| label2 =understand
| value2 =16.6
| color2 =3 
| label3 =apply
| value3 =16.6 
| color3 =5 
| label4 =analyze
| value4 =16.6
| color4 =6
| label5 =evaluate
| value5 =16.6
| color5 =9
| label6 =design
| value6 =16.6
| color6 =10
  • The parameter |radius= specifies the radius of the pie chart in pixels. Do not include a "px" suffix. If omitted, it will default to 100.
  • The parameter |thumb= specifies which side of the page the chart is floated to and defaults to right, as with image files. To make the chart appear on the left side of the page, specify |thumb=left.
  • The parameter |caption= specifies a string of text that appears on a line just before the legend.
  • The parameter |footer= specifies a string of text that appears below the legend.
  • The parameter |other=, if specified, will cause an "Other" item to appear in the legend.
  • Each |labelN= 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.
  • Each |valueN= is the percentage that the slice represents. Do not include the percent sign. Also note that it is shown in the legend as written (just after the label), without any rounding or other reformatting.
  • Each |colorN= is a CSS color code or name. If omitted, it will default to the following hues:
  1.   light blue
  2.   strong blue
  3.   light green
  4.   strong green
  5.   fuchsia
  6.   red
  7.   light orange
  8.   strong orange
  9.   light purple
  10.   strong purple
  11.   light yellow
  12.   brown

Limitations[manbasini tahrirlash]

  • The values need to be percentages.
  • Google Chrome and Safari do not appear to anti-alias borders, so the lines are a bit jagged. (For Chrome, this issue seems to be resolved; 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.
  • Max. number of slices that can be displayed: 30

Bu qanday ishlaydi[manbasini tahrirlash]

  One (42%)
  Two (32%)
  Three (12%)
  Four (3%)
  Five (2%)
  Six (1%)
  Other (8%)

This is a 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.

Namuna[manbasini tahrirlash]

en:Religion in the Czech Republic as of 2001.

  en:Atheists and agnostiklar (59%)
  Katoliklar (26.8%)
  Protestantlar (2.5%)
  Other (11.7%)

The following example of Andoza:PieChart generates the pie chart shown at right.

 | caption=[[:en:Religion in the Czech Republic]] as of 2001.
 | other = yes
 | label1 = [[:en:Atheist]]s and [[:en:Agnosticism|agnostiklar]]
 | value1 = 59 | color1 = silver
 | label2 = [[:en:Catholic Church|katholiklar]]
 | value2 = 26.8 | color2 = #008
 | label3 = [[:en:Protestantism|Protestantlar]]
 | value3 = 2.5 | color3 = #08f

See also[manbasini tahrirlash]

Formatted/colorized template source for Template:Pie chart

Skript xatosi: „FormatTemplate“ moduli yoʻq.

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

Skript xatosi: „FormatTemplate“ moduli yoʻq.

Formatted/colorized template source for Template:Legend

Skript xatosi: „FormatTemplate“ moduli yoʻq.

Formatted/colorized template source for Template:Trim

Skript xatosi: „FormatTemplate“ moduli yoʻq.