תבנית:Line chart


The following documentation is located at Template:Line chart/doc. [edit]


This template allows the creation of line charts with the following limitations:

  • Maximum number of data series: 10
  • Maximum number of x-values: 25

It is based on the extension EasyTimeline and has been copied from fr:Modèle:Graphique polygonal.

{{Line chart
 | padding_top              = 
 | padding_bottom           = 
 | padding_right            = 
 | padding_left             = 
 | width                    = 
 | height                   = 
 | number_of_x-values       = 
 | y_max                    = 
 | y_min                    =
 | number_of_series         = 
 | color_background         = 
 | scale                    = 
 | color_primary_scale      = 
 | color_secondary_scale    = 
 | interval_primary_scale   = 
 | interval_secondary_scale = 
 | color_series_1           = 
 | ...
 | color_series_10          = 
 | label_x1                 = 
 | ...
 | label_x25                = 
 | S01V01                   = 
 | ...
 | S01V25                   = 
 | S02V01                   = 
 | ...
 | S02V25                   = 
 | ...
 | S10V01                   = 
 | ...
 | S10V25                   = 
}}

Parameters

עריכה

Layout parameters

עריכה

The following parameters are optional:

  • width: width in pixels of the chart (default: 500)
  • height: height in pixels of the chart (default: 350)
  • padding_top: margin in pixels between the top of the image and the top of the drawing area (default: 10)
  • padding_bottom: margin in pixels between the bottom of the image and the bottom of the drawing area (default: 20)
  • padding_right: margin in pixels between the right of the image and the right of the drawing area (default: 10)
  • padding_left: margin in pixels between the left of the image and the left of the drawing area (default: 30)

Form and color parameters

עריכה

The following parameters are optional:

  • color_background: Background color (default: white).
  • color_primary_scale: Color of the primary lines of the ordinate scale (default: dark gray).
  • color_secondary_scale: Color of the secondary lines of the ordinate scale (default: light gray).
  • color_series_1 to color_series_10: Color of each line of data series (default: red, blue, green, yelloworange, purple, magenta, orange, lavender, powderblue, brightgreen).
  • thickness_series1 to thickness_series10 : Thickness of each line of data series, from 0.1 (very thin) to 10 (very thick). Default: 0.8

Color can be described with one of the keywords listed in the EasyTimeline documentation, or in the format rgb(red,green,blue), where red, green and blue are values from 0 to 1. Refer to the documentation to convert web colors into this format.

Data series parameters

עריכה
  • SaaVxx: Value xx (from 01 to 25) of the series aa (from 01 to 10). The subsequent value must be between 0 and the parameter y_max (see below).
    • Example: S05V01 = 25 means: "The first value (at x-axis position 01) of the fifth series (05) is 25".
    • Note: X-axis values may be omitted. For example, if values for S01V01 and S01V03 are provided, but not for S01V02, a direct line between the x-axis value at 1 and at 3 is drawn.
  • points: Determines whether points symbolizing the x-axis value of the data are to be added to the graph. points = yes means that such points are added for all data series. All other values of the parameter are ignored.

Axis parameters

עריכה
  • interval_primary_scale: Interval between each principal subdivision of the y-axis. Mandatory.
  • interval_secondary_scale: Interval between each secondary subdivision of the y-axis (if the parameter scale is given a value of yes).
  • number_of_x-values : number of values ​​on the x-axis. Mandatory.
  • label_x1 to label_x25: the labels (text) of the x-axis values. The number of these parameters that is set must be equal to the value number_of_x-values. Default value: a number between 1 and 25.
  • y_max : Maximum value on the y-axis. Mandatory.
  • y_min : Minimum value on the y-axis. Default is zero.

The following code:

{{Line chart
| color_background = white
| width = 500
| height = 350
| padding_left = 40
| padding_right = 15
| padding_top = 10
| padding_bottom = 20
| number_of_series = 3
| number_of_x-values = 10 
| label_x1 = Val. 1 | label_x2 = Val. 2 | label_x3 = Val. 3 | label_x4 = Val. 4 | label_x5 = Val. 5
| label_x6 = Val. 6 | label_x7 = Val. 7 | label_x8 = Val. 8 | label_x9 = Val. 9 | label_x10 = Val. 10
| y_max = 3000
| y_min = 1000
| scale = yes
| interval_primary_scale = 1000
| interval_secondary_scale = 100
| S01V02 = 2200 | S01V03 = 2400 | S01V04 = 2500 | S01V05 = 2600 | S01V06 = 2500
| S02V01 = 1400 | S02V02 = 2000 | S02V03 = 1600 | S02V04 = 1800 | S02V05 = 2400 
| S02V06 = 2400 | S02V07 = 2500 | S02V08 = 2000 | S02V09 = 1600 | S02V10 = 1800
| S03V01 = 1800 | S03V04 = 2000 | S03V05 = 1600 | S03V06 = 1800 | S03V07 = 2400 
| S03V09 = 2400
| points = yes
}}
{{legend|red|Series 1}}
{{legend|blue|Series 2}}
{{legend|green|series 3}}

renders:


  Series 1


  Series 2


  Series 3

Limitations

עריכה
  • The magic word formatnum cannot be used to format the x-axis values.
  • There is no alternate text for accessibility purposes.

See also

עריכה