Benutzer:111Alpha/Kreisdiagramm

aus Wikipedia, der freien Enzyklopädie



Diese Seite wurde aus der englischen Wikipedia übertragen und wurde bisher noch nicht übersetzt!

Verwendung

The labels and values of up to ten slices may be specified. All the parameters for three 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.

{{Kreisdiagramm
| Ausrichtung = 
| Titel = 
| Andere = 
| Name1 =remember
| Wert1 =16.6
| Farbe1 =2
| Name2 =understand
| Wert2 =16.6
| Farbe2 =3
| Name3 =apply
| Wert3 =16.6
| Farbe3 =5
| Name4 =analyse
| Wert4 =16.6
| Farbe4 =6
| Name5 =evaluate
| Wert5 =16.6
| Farbe5 =9
| Name6 =design
| Wert6 =16.6
| Farbe6 =10
}}
  • option "Ausrichtung" 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 Ausrichtung=left.
  • "Titel" is a string of text that appears on a line just before the legend.
  • option "Andere", if specified, will cause an „Andere“ item to appear in the legend.
  • each "NameN" 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 "WertN" 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 "FarbeN" is a CSS color code or name. If omitted, it will default to the following hues:
1.
  • red
  • 2.
  • green
  • 3.
  • blue
  • 4.
  • yellow
  • 5. Grünes Häkchensymbol für ja
    6.
  • aqua
  • 7.
  • brown
  • 8. Grünes Häkchensymbol für ja
    9.
  • purple
  • 10.
  • sienna
  • Limitations

    • The template does not render correctly on mobile devices. See this page on the mobile site and a user's report of this issue.
    • Minor issues with printing exist. We also need to implement a good fallback for Books.
    • The values need to be percentages.
    • Google Chrome and Safari do not appear to en: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

  • Andere (8 %)
  • Andere (11.7 %)
  • 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.

    Note that in the legacy browser Internet Explorer 6, applying transparent borders the standard way does not work. A workaround is used in the form of the 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 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 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 {{Vorlage:Kreisdiagramm/Scheibe}} 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 Vorlage:Kreisdiagramm generates the pie chart show at right.

     {{Kreisdiagramm
     | Titel=[[Religion in the Czech Republic]] as of 2001.
     | Andere = Ja
     | Name1 = [[Atheist]]s and [[Agnosticism|agnostics]]
     | Wert1 = 59 | Farbe1 = silver
     | Name2 = [[Catholic Church|Catholics]]
     | Wert2 = 26.8 | Farbe2 = #008
     | Name3 = [[Protestantism|Protestants]]
     | Wert3 = 2.5 | Farbe3 = #08f
     }}
    

    See also