Copyright © 2009, 2010 Dave Pawson
| Revision History | ||
|---|---|---|
| 2009-07-28T08:34:13Z | Dave Pawson | |
Initial issue | ||
| 2010-02-02T12:35:35Z | Dave Pawson | |
Expanded on xAxisType | ||
| 2010-02-06T10:09:11Z | Dave Pawson | |
Added zip file of Jakubs distribution, including rng schemas | ||
Table of Contents
What is it?

Graph2svg is a set of three scripts which automatically transform XML data into a standard graphic form called SVG, a W3C standard. It was all developed by Jakub Vojtíšek and code is to be found at code.google.com
I have loaded a copy here, with a couple of minor updates, including the translations of the comments and relaxng schemas. Download here
It draws a graph or chart in a number of forms. For the input format, XML is used and a schema provided. The output is a an image in SVG which can by used directly or transformed into alternative graphics formats. There are a wide variety of tools for such transformations.
Because SVG is an open, standard format based on XML, it can be produced using the XSLT transformation language. We using XSLT version 2.0 in graph2svg.
Three XML schemas are defined for different types of graphs or charts. The graphs are divided systematically into three groups not according to their visual form but according to the number of data series with which they are formed
OSGR — graphs with one data serie (One-Series GRaph). Can by used for pie chart, column, line or other type of graph.

A simple pie chart
MSGR — graphs with more data series (Multi-Series GRaph). For a comparison of values using columns, area or line graphs or their combination. Also can be drawn as a stacked graph.

A combined chart, for comparison
XYGR — type of graph ideal for representation of various curves and function graphs which are defined by series of points. The classic X-Y graph

An X-Y graph
If you look at the examples (in the distribution) you will see a selection of graph2svg generated graphics with both the source XML and the output SVG. You will see how the final appearance of a graph can be changed by means of setting only a few attributes on the graph, the values or even single points on a graph. The data series can be depicted as several types of columns with the optional 3D effect, as various marks or as straight or smooth lines of many types with the possibility of filling the areas under the curve. The series can be coloured and it is possible to set the appearance of individual points to make it stand out visually. The size of graphs, the layout of graph parts and limits of data axes are calculated automatically by the stylesheets reducing the work of the user.
Briefly, graph2svg is a set of three relax NG schemas for depicting of graphs and three XSLT scripts for transformation of these graphs into SVG.
Also provided as part of the schema are Schematron rules to warn the user of invalid combinations of attributes. This reduces the time taken to obtain the desired result.