Шаблон:SVG Chart

Материал из Revelation Wiki
Перейти к навигацииПерейти к поиску


Документация

Шаблон:Mbox

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

  1. Create the template {{SVG Chart}} somewhere.
  2. Press the "Preview" button. You get the SVG instructions.
  3. Paste (with mouse) and copy (<Ctrl>+<C>) the received SVG instructions.
  4. Create an SVG file e.g. mychart.svg on your computer.
  5. Open that file with a plain text editor, e.g. Notepad.
  6. Paste (<Ctrl>+<V>) the copied data into the text file. Save that file (<Ctrl>+<S>).
  7. Check the file by drag and drop on your browser, with Jarry1250's SVG Check or File:Test.svg.
  8. If the check is successfully, store your file with Commons:Upload.

Main parameters

Required parameters

Шаблон:SVG Chart/doc/params

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

Шаблон:SVG Chart/doc/params

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)

Шаблон:SVG Chart/doc/params

Grid

You can realize vertical and horizontal grid lines. The following parameters are available: Шаблон:SVG Chart/doc/params

Legend

Шаблон:SVG Chart/doc/params

Additional text

Шаблон:SVG Chart/doc/params

Graph

Шаблон:SVG Chart/doc/params

Marker

An alternate possibility is to show markers. In this case, the line stay visible or be off. Шаблон:SVG Chart/doc/params

Image size

Шаблон:SVG Chart/doc/params

Font size

Шаблон:SVG Chart/doc/params

SVG additionals

Шаблон:SVG Chart/doc/params

Correction of errors of the Wikipedia software

Шаблон:SVG Chart/doc/params

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

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.