Template:Line chart/doc
This is a documentation subpage for Template:Line chart. It contains usage information, categories and other content that is not part of the original template page. |
Note: Template:Graph:Chart is an alternative template that may produce higher-quality charts.
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 French Wikipedia.
Syntax[edit source]
{{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[edit source]
Layout parameters[edit source]
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[edit source]
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
tocolor_series_10
: Color of each line of data series (default: red, blue, green, yelloworange, purple, magenta, orange, lavender, powderblue, brightgreen).thickness_series1
tothickness_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[edit source]
SaaVxx
: Value xx (from 01 to 25) of the series aa (from 01 to 10). The subsequent value must be between 0 and the parametery_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.
- Example:
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[edit source]
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 parameterscale
is given a value ofyes
).number_of_x-values
: number of values on the x-axis. Mandatory.label_x1
tolabel_x25
: the labels (text) of the x-axis values. The number of these parameters that is set must be equal to the valuenumber_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.
Example[edit source]
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:
<timeline>
ImageSize = width:500 height:350
PlotArea = left:40 right:15 top:10 bottom:20
TimeAxis = orientation:vertical
AlignBars = justify
DateFormat = x.y
Colors =
id:scaleprin value:gray(0.3) id:scalesec value:gray(0.8) id:fond value:white id:serie1 value:red id:serie2 value:blue id:serie3 value:green id:serie4 value:yelloworange id:serie5 value:purple id:serie6 value:magenta id:serie7 value:orange id:serie8 value:lavender id:serie9 value:powderblue id:serie10 value:brightgreen
Period = from:1000 till:3000 ScaleMajor = increment:1000 start:1000 gridcolor:scaleprin ScaleMinor = increment:100 start:1000 gridcolor:scalesec BackgroundColors = canvas:fond
BarData=
bar:data1 text:Val. 1 bar:data2 text:Val. 2 bar:data3 text:Val. 3 bar:data4 text:Val. 4 bar:data5 text:Val. 5 bar:data6 text:Val. 6 bar:data7 text:Val. 7 bar:data8 text:Val. 8 bar:data9 text:Val. 9 bar:data10 text:Val. 10
- DEFINITION DES ABSCISSES
- La première est confondue avec l'axe donc le pas "1" correspond à la seconde valeur
- On fait des variables pour plus de lisibilité
- Dimensionnement des curseurs d'abscisse
Define $ycurdeb = 17 Define $ycurfin = 22
- Ordonnées series 1
Define $yS01V01 = Expression error: Unrecognized punctuation character "[". Define $yS01V02 = Expression error: Unrecognized punctuation character "[". Define $yS01V03 = Expression error: Unrecognized punctuation character "[". Define $yS01V04 = Expression error: Unrecognized punctuation character "[". Define $yS01V05 = Expression error: Unrecognized punctuation character "[". Define $yS01V06 = Expression error: Unrecognized punctuation character "[". Define $yS01V07 = Expression error: Unrecognized punctuation character "[". Define $yS01V08 = Expression error: Unrecognized punctuation character "[". Define $yS01V09 = Expression error: Unrecognized punctuation character "[". Define $yS01V10 = Expression error: Unrecognized punctuation character "[". Define $yS01V11 = Expression error: Unrecognized punctuation character "[". Define $yS01V12 = Expression error: Unrecognized punctuation character "[". Define $yS01V13 = Expression error: Unrecognized punctuation character "[". Define $yS01V14 = Expression error: Unrecognized punctuation character "[". Define $yS01V15 = Expression error: Unrecognized punctuation character "[". Define $yS01V16 = Expression error: Unrecognized punctuation character "[". Define $yS01V17 = Expression error: Unrecognized punctuation character "[". Define $yS01V18 = Expression error: Unrecognized punctuation character "[". Define $yS01V19 = Expression error: Unrecognized punctuation character "[". Define $yS01V20 = Expression error: Unrecognized punctuation character "[". Define $yS01V21 = Expression error: Unrecognized punctuation character "[". Define $yS01V22 = Expression error: Unrecognized punctuation character "[". Define $yS01V23 = Expression error: Unrecognized punctuation character "[". Define $yS01V24 = Expression error: Unrecognized punctuation character "[". Define $yS01V25 = Expression error: Unrecognized punctuation character "[".
- Ordonnées series 2
Define $yS02V01 = Expression error: Unrecognized punctuation character "[". Define $yS02V02 = Expression error: Unrecognized punctuation character "[". Define $yS02V03 = Expression error: Unrecognized punctuation character "[". Define $yS02V04 = Expression error: Unrecognized punctuation character "[". Define $yS02V05 = Expression error: Unrecognized punctuation character "[". Define $yS02V06 = Expression error: Unrecognized punctuation character "[". Define $yS02V07 = Expression error: Unrecognized punctuation character "[". Define $yS02V08 = Expression error: Unrecognized punctuation character "[". Define $yS02V09 = Expression error: Unrecognized punctuation character "[". Define $yS02V10 = Expression error: Unrecognized punctuation character "[". Define $yS02V11 = Expression error: Unrecognized punctuation character "[". Define $yS02V12 = Expression error: Unrecognized punctuation character "[". Define $yS02V13 = Expression error: Unrecognized punctuation character "[". Define $yS02V14 = Expression error: Unrecognized punctuation character "[". Define $yS02V15 = Expression error: Unrecognized punctuation character "[". Define $yS02V16 = Expression error: Unrecognized punctuation character "[". Define $yS02V17 = Expression error: Unrecognized punctuation character "[". Define $yS02V18 = Expression error: Unrecognized punctuation character "[". Define $yS02V19 = Expression error: Unrecognized punctuation character "[". Define $yS02V20 = Expression error: Unrecognized punctuation character "[". Define $yS02V21 = Expression error: Unrecognized punctuation character "[". Define $yS02V22 = Expression error: Unrecognized punctuation character "[". Define $yS02V23 = Expression error: Unrecognized punctuation character "[". Define $yS02V24 = Expression error: Unrecognized punctuation character "[". Define $yS02V25 = Expression error: Unrecognized punctuation character "[".
- Ordonnées series 3
Define $yS03V01 = Expression error: Unrecognized punctuation character "[". Define $yS03V02 = Expression error: Unrecognized punctuation character "[". Define $yS03V03 = Expression error: Unrecognized punctuation character "[". Define $yS03V04 = Expression error: Unrecognized punctuation character "[". Define $yS03V05 = Expression error: Unrecognized punctuation character "[". Define $yS03V06 = Expression error: Unrecognized punctuation character "[". Define $yS03V07 = Expression error: Unrecognized punctuation character "[". Define $yS03V08 = Expression error: Unrecognized punctuation character "[". Define $yS03V09 = Expression error: Unrecognized punctuation character "[". Define $yS03V10 = Expression error: Unrecognized punctuation character "[". Define $yS03V11 = Expression error: Unrecognized punctuation character "[". Define $yS03V12 = Expression error: Unrecognized punctuation character "[". Define $yS03V13 = Expression error: Unrecognized punctuation character "[". Define $yS03V14 = Expression error: Unrecognized punctuation character "[". Define $yS03V15 = Expression error: Unrecognized punctuation character "[". Define $yS03V16 = Expression error: Unrecognized punctuation character "[". Define $yS03V17 = Expression error: Unrecognized punctuation character "[". Define $yS03V18 = Expression error: Unrecognized punctuation character "[". Define $yS03V19 = Expression error: Unrecognized punctuation character "[". Define $yS03V20 = Expression error: Unrecognized punctuation character "[". Define $yS03V21 = Expression error: Unrecognized punctuation character "[". Define $yS03V22 = Expression error: Unrecognized punctuation character "[". Define $yS03V23 = Expression error: Unrecognized punctuation character "[". Define $yS03V24 = Expression error: Unrecognized punctuation character "[". Define $yS03V25 = Expression error: Unrecognized punctuation character "[".
- Ordonnées series 4
- Ordonnées series 5
- Ordonnées series 6
- Ordonnées series 7
- Ordonnées series 8
- Ordonnées series 9
- Ordonnées series 10
- Les curseurs d'axe x (EasyTimeline ne permettant pas de les intégrer)
LineData =
color:black layer:back width:0.1 points:($x2, $ycurdeb)($x2, $ycurfin) points:($x3, $ycurdeb)($x3, $ycurfin) points:($x4, $ycurdeb)($x4, $ycurfin) points:($x5, $ycurdeb)($x5, $ycurfin) points:($x6, $ycurdeb)($x6, $ycurfin) points:($x7, $ycurdeb)($x7, $ycurfin) points:($x8, $ycurdeb)($x8, $ycurfin) points:($x9, $ycurdeb)($x9, $ycurfin) points:($x10, $ycurdeb)($x10, $ycurfin)
LineData =
color:serie1 layer:front width:0.5
LineData =
color:serie2 layer:front width:0.5
LineData =
color:serie3 layer:front width:0.5
</timeline>
Limitations[edit source]
- The magic word formatnum cannot be used to format the x-axis values.
- There is no alternate text for accessibility purposes.
See also[edit source]
{{Graph:Chart}}