Шаблон:SVG Chart
This template creates charts by the generation of code for an SVG file. The special feature is that the data is retained in its original format and can be easily supplemented or changed later. In particular, a clear structure is produced, which can easily be modified with any text editor.
Quick start
Copy sample template:
{{SVG Chart | XAxisText = Year | YAxisText = Index | LegendType = none | XMin = 1990 | XMax = 2015 | YMin = 5 | YMax = 20 | Graph1Values = 1990 6.16 2000 10.72 2005 11.15 2012 17.29 }} |
Copy the resulting preview text into a text file chart.svg and open this file in your browser or SVG viewer. You get a result like these: |
Usage
- Create the template {{SVG Chart}} somewhere.
- Press the "Preview" button. You get the SVG instructions.
- Paste (with mouse) and copy (<Ctrl>+<C>) the received SVG instructions.
- Create an SVG file e.g. mychart.svg on your computer.
- Open that file with a plain text editor, e.g. Notepad.
- Paste (<Ctrl>+<V>) the copied data into the text file. Save that file (<Ctrl>+<S>).
- Check the file by drag and drop on your browser, with Jarry1250's SVG Check or File:Test.svg.
- If the check is successfully, store your file with Commons:Upload.
Main parameters
Required parameters
The differences of XMax - XMin and YMax - YMin should so far as possible similar. If not, divide or multiply the x or y chart values by multiples of 10.
Optional parameters
Additional optional parameters
Axis
Every axis is shown automatically. Commonly are to be shown markers on axis. This is possible with the following values: Шаблон:SVG Chart/doc/params
2nd (Right) Axis (Optional)
Grid
You can realize vertical and horizontal grid lines. The following parameters are available: Шаблон:SVG Chart/doc/params
Legend
Additional text
Graph
Marker
An alternate possibility is to show markers. In this case, the line stay visible or be off. Шаблон:SVG Chart/doc/params
Image size
Font size
SVG additionals
Correction of errors of the Wikipedia software
Example
Sample
{{SVG Chart | Title = My test chart | XAxisText = Year | YAxisText = Index | XMin = 1990 | XMax = 2015 | YMin = 6 | YMax = 13 | Graph1Values = 1991 7.59 1994 8.56 1997 9 2000 9.27 2003 9.69 2006 10.16 2009 10.7 2012 11.29 }}
More examples
- US Natural Gas Production.svg
See the source Шаблон:SVG Chart/doc/longlink.
- US Crude Oil Production and Imports.svg
See the source Шаблон:SVG Chart/doc/longlink.
- World energy consumption.svg
See the source Шаблон:SVG Chart/doc/longlink.
For further examples look here.
Upload
- After the upload insert before {{int:filedesc}}
- {{handSVG|||H}}
- Insert after {{int:filedesc}}
- == Generated with ''Wikimedia SVG Chart'' ==
- {{SVG Chart/box}}
- This will add the category to the image
- [[Category:Created with Commons SVG Chart]]
- Add the source code of chart to the talk page additional with the headline == Source ==.
See also
Another version of SVG Chart by the modern programming language Lua with more possibilities for the future is available at: Module:SVG_Chart.
This variant is to be used with
{{#invoke: SVG_Chart | SVGChart |
instead of
{{SVG Chart
Development
If you have a question or a suggestion, share this here.
For more informations see: Programming of Wikimedia SVG Chart.