Search Locate Previous Next Contents

ch.Include – add arbitrary content (SVG filters and symbols)

Includes arbitrary text in the output stream. Ignored by PostScript and our own viewers – may be used to get customised gradient fills and 3D effects included in SVG output.


The argument is either an array of text items containing the SVG definitions to be included, or a list of text files.

ch.Include ‘grads,‘filters
ch.Include'grads.txt' 'filters.txt'

The included filters will be passed directly into the output stream, and may be referenced by ch.DefineTile to make custom fill patterns, ch.DefineEffect to enhance lines or text, or ch.DefineMark to make custom markers. Note that a reasonable selection of gradients are preset for you as patterns 24-39.

Defining custom filters
Filters must be wrapped inside a <defs> block and identified appropriately, for example:

<defs>
<desc>Background wash (light colour)</desc>
<linearGradient id="wash" gradientTransform="rotate(35)" >
<stop offset="15%" style="stop-color:#D7E1E3"/>
<stop offset="90%" style="stop-color:#9CDCEE"/>
</linearGradient>
</defs>

This filter would be referred to as “#wash” in a call to DefineTile.

Defining custom markers
Marker definitions are made using the <symbol> tag, and may specify the bounding box of the symbol:

<symbol id="duck" viewBox="0 0 3200 2400">
<path d=” M 424 1424
C 619 1589 790 1613 1105 1457
C 1417 1301 1474 1325 1564 1340
C 1654 1352 1681 1388 1723 1355
C 1867 1241 1684 836 1915 716
C 2032 656 2164 704 2263 794
C 2362 884 2446 1052 2647 1055
C 2587 1190 2563 1202 2248 1190
C 1933 1181 2014 1361 2185 1511
C 2266 1589 2425 1712 2377 1898
C 2329 2084 2119 2147 1888 2147
C 1657 2147 1060 2117 832 2015
C 622 1877 430 1547 424 1424 z”
style=”stroke:#000000; fill:Teal;
stroke-width:20;” />
</symbol>

You would refer to this symbol as “#duck” in the marker definition. In this example, the duck will probably not centre visually at the data point. When you design your symbols, be careful to make the (0,0) point the visual focus of the image.

See also ...
ch.DefineEffect – set up SVG effects
ch.DefineMarker – define markers
ch.DefineTile – define new fill patterns
Patterns – pattern cycle


Continue to: ch.InnerGap – inner gap on barcharts
© Copyright Causeway Graphical Systems Ltd 2004