< MediaWiki User Guide
MediaWiki has graph extension that allows to enter data into the wiki markup and have a graph rendered automatically as a raster image. Many wikis have Graph:Chart template that encapsulates the raw markup for the graphs.
A mimimal example of a line chart:
{{Graph:Chart|x=1,2,3,4,5|y=5,4,3,2,1}}
A bar chart with dimensions, axis titles, a grid that shows values above the bars and setting of a bar color:
{{Graph:Chart
|width=700|height=150
|xAxisTitle=Axis X|yAxisTitle=Axis Y
|type=rect
|xGrid=
|yGrid=
|colors=#66CC66
|showValues=offset:2
|x=1,2,3,4,5|y=5,4,3,2,1}}
A line chart with x-axis values of the type date and x-axis labels at an angle:
{{Graph:Chart
|type=line
|xType=date
|xAxisFormat=%b %e
|xAxisAngle=-45
|x=2020/01/05,2020/01/01,2020/01/02,2020/01/03,2020/01/04|y=1,5,4,3,2}}
A line chart with two data series with line colors set and a legend:
{{Graph:Chart
|type=line
|colors=#0066cc,#cc6600
|legend=Legend
|y1Title=x squared
|y2Title=x ^ 3
|x=1,2,3,4,5
|y1=1,4,9,16,25
|y2=1,8,27,64,125
}}
A semilog line chart, that is, one with logarithmic scale of the y-axis:
{{Graph:Chart
|type=line
|yScaleType=log
|x=1, 2, 3, 4, 5, 6, 7, 8, 9, 10
|y=3, 7, 20, 55, 148, 403, 1097, 2981, 8103, 22026
}}
A pie chart with colors, values shown in the chart and a legend showing the x values:
{{Graph:Chart|
|type=pie
|width=150
|legend=Legend
|colors=#66C, #C66, #6C6, #CC6, #C6C, #6CC
|showValues=
|x=Milk, Honey, Bread, Rice, Cheese
|y=100, 200, 150, 300, 50
}}
Links
- Extension:Graph/Demo, mediawiki.org
- Extension:Graph, mediawiki.org
- Template:Graph:Chart, wikipedia.org
- Module:Graph, mediawiki.org - documents arguments of graphing, such as type
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.