Graph to SVG.

Legal Notice
Legal Notice
Revision History
2009-07-28T08:34:13ZDave Pawson

Initial issue

2010-02-02T12:35:35ZDave Pawson

Expanded on xAxisType

2010-02-06T10:09:11ZDave Pawson

Added zip file of Jakubs distribution, including rng schemas


Table of Contents

1. Introduction
2. Examples
2.1. OSGR - One series graphs
2.2. MSGR - multi series graphs examples.
2.3. XYGR, Classic point and curve graphs
2.4. Different types of X axis.
2.5. HTML2GR
A. GNU Free Documentation License
1. PREAMBLE
2. APPLICABILITY AND DEFINITIONS
3. VERBATIM COPYING
4. COPYING IN QUANTITY
5. MODIFICATIONS
6. COMBINING DOCUMENTS
7. COLLECTIONS OF DOCUMENTS
8. AGGREGATION WITH INDEPENDENT WORKS
9. TRANSLATION
10. TERMINATION
11. FUTURE REVISIONS OF THIS LICENSE
12. ADDENDUM: How to use this License for your documents

1. Introduction

What is it?

The graph to svg logo!

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 pie chart, in full color

    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 combination chart for comparisons

    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 XY 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.