XML technologies / SVG / Manipulating graphics with external scripts / Using external scripts for manipulation / Structure of the example
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
The following example consists of an HTML page into which the same SVG graphic is inserted twice. Both <EMBED> tags are named with the id attribute, and each chart has an XML file containing its formatting settings. When the HTML page loads, JavaScript opens these XML files, reads their values and assigns them to the charts. The browser must support ActiveX object creation, currently only available in Internet Explorer for Windows. Since access to SVG files in HTML has the same restrictions, this poses no additional problem. Processing XML files requires Internet Explorer 5.0 or later, which provides the XML DOM for XML files.
The inserted SVG graphic is a bar chart with at most four bars, axis labels, a title and a legend.
Figure: SVG graphic before formatting by script.
The script formats the graphic according to the XML file, which also supplies the data series’ values and labels. After formatting, it could look as follows:
Figure: Script result.
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top