XML technologies / SVG / The coordinate system of SVG graphics / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
Coordinate systems can be created by applying the
transformattribute to the tag or a parent group.The SVG file containing the square should look as follows:
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg>
<rect width="7" height="7" x="10" y="10" />
</svg>
To position the text beside the square, its y coordinate must match the square’s lower-left corner. This is the square’s y coordinate plus its height:
<text x="20" y="17" style="font-size:10px">Inhalt</text>To group the elements, enclose them in the
<g>tag. Assign a name with theidattribute.
<g id="zeile1">
<rect width="7" height="7" x="10" y="10" />
<text x="20" y="17" style="font-size:10px">Inhalt</text>
</g>
To position the group, add the
transformattribute:<g id="zeile1" transform="translate(30,70)">To rotate by 30°, extend the
transformattribute with therotateinstruction:<g id="zeile1" transform="translate(30,70) rotate(30)">
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