| 1 |
<xsl:stylesheet xmlns="http://www.w3.org/2000/svg" |
|---|
| 2 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 3 |
xmlns:xlink="http://www.w3.org/2000/xlink/namespace/" |
|---|
| 4 |
version="1.0"> |
|---|
| 5 |
<xsl:output omit-xml-declaration="no"/> |
|---|
| 6 |
<xsl:template match="/graphData"> |
|---|
| 7 |
<xsl:variable name="max"> |
|---|
| 8 |
<xsl:value-of select="maxy"/> |
|---|
| 9 |
</xsl:variable> |
|---|
| 10 |
<xsl:variable name="min"> |
|---|
| 11 |
<xsl:value-of select="miny"/> |
|---|
| 12 |
</xsl:variable> |
|---|
| 13 |
<xsl:variable name="maxy2"> |
|---|
| 14 |
<xsl:value-of select="maxy2"/> |
|---|
| 15 |
</xsl:variable> |
|---|
| 16 |
<xsl:variable name="miny2"> |
|---|
| 17 |
<xsl:value-of select="miny2"/> |
|---|
| 18 |
</xsl:variable> |
|---|
| 19 |
<xsl:variable name="maxx"> |
|---|
| 20 |
<xsl:value-of select="maxx"/> |
|---|
| 21 |
</xsl:variable> |
|---|
| 22 |
<xsl:variable name="minx"> |
|---|
| 23 |
<xsl:value-of select="minx"/> |
|---|
| 24 |
</xsl:variable> |
|---|
| 25 |
<svg width="800" height="600" onload="getSVGDoc(evt)" onzoom="ZoomControl()"> |
|---|
| 26 |
<defs> |
|---|
| 27 |
<g id="star" transform="scale(0.21)"> |
|---|
| 28 |
<polyline points="48,16,16,96,96,48,0,48,80,96"> |
|---|
| 29 |
</polyline> |
|---|
| 30 |
</g> |
|---|
| 31 |
<g id="triangle" transform="scale(0.7)"> |
|---|
| 32 |
<path id="Triangle" d="M 0 25 L 10 15 L 20 25 z" style="stroke:none"/> |
|---|
| 33 |
</g> |
|---|
| 34 |
<g id="square" transform="scale(1)"> |
|---|
| 35 |
<rect width="18" height="18"> |
|---|
| 36 |
</rect> |
|---|
| 37 |
</g> |
|---|
| 38 |
<g id="rectangle" transform="scale(1)"> |
|---|
| 39 |
<rect width="7" height="22"> |
|---|
| 40 |
</rect> |
|---|
| 41 |
</g> |
|---|
| 42 |
<g id="none" transform="scale(1)"> |
|---|
| 43 |
</g> |
|---|
| 44 |
<script type="text/javascript"> |
|---|
| 45 |
<![CDATA[ |
|---|
| 46 |
/* this code was largely reused from the excellent website SVG - Learning by Coding (http://svglbc.datenverdrahten.de/) */ |
|---|
| 47 |
var svgdoc,svgroot; |
|---|
| 48 |
function getSVGDoc(load_evt) |
|---|
| 49 |
{ |
|---|
| 50 |
svgdoc=load_evt.target.ownerDocument; |
|---|
| 51 |
svgroot=svgdoc.documentElement; |
|---|
| 52 |
|
|---|
| 53 |
texte=svgdoc.getElementById("tooltip").getElementsByTagName("text"); |
|---|
| 54 |
} |
|---|
| 55 |
function ShowTooltip(mousemove_event,txt) |
|---|
| 56 |
{ |
|---|
| 57 |
var ttrelem,tttelem,posx,posy,curtrans,ctx,cty,txt; |
|---|
| 58 |
var sollbreite,maxbreite,ges,anz,tmp,txl,neu,i,k,l |
|---|
| 59 |
ttrelem=svgdoc.getElementById("ttr"); |
|---|
| 60 |
tttelem=svgdoc.getElementById("ttt"); |
|---|
| 61 |
posx=mousemove_event.clientX; |
|---|
| 62 |
posy=mousemove_event.clientY; |
|---|
| 63 |
for(i=1;i<=5;i++)texte.item(i).firstChild.data=""; |
|---|
| 64 |
sollbreite=150; |
|---|
| 65 |
tttelem.childNodes.item(0).data=txt; |
|---|
| 66 |
ges=tttelem.getComputedTextLength(); |
|---|
| 67 |
tttelem.childNodes.item(0).data=""; |
|---|
| 68 |
anz=Math.ceil(ges/sollbreite); |
|---|
| 69 |
tmp=txt.split(" "); |
|---|
| 70 |
txl=new Array(tmp.length); |
|---|
| 71 |
neu=new Array(anz); |
|---|
| 72 |
for(i=0;i<tmp.length;i++) |
|---|
| 73 |
{ |
|---|
| 74 |
tttelem.childNodes.item(0).data=tmp[i]; |
|---|
| 75 |
txl[i]=tttelem.getComputedTextLength(); |
|---|
| 76 |
} |
|---|
| 77 |
k=0; |
|---|
| 78 |
maxbreite=0; |
|---|
| 79 |
for(i=0;i<anz;i++) |
|---|
| 80 |
{ |
|---|
| 81 |
l=0,neu[i]=""; |
|---|
| 82 |
while(l+txl[k]<1.1*sollbreite && k<tmp.length) |
|---|
| 83 |
{ |
|---|
| 84 |
l+=txl[k]; |
|---|
| 85 |
neu[i]+=tmp[k]+" "; |
|---|
| 86 |
k++; |
|---|
| 87 |
if(maxbreite<l)maxbreite=l; |
|---|
| 88 |
} |
|---|
| 89 |
} |
|---|
| 90 |
curtrans=svgroot.currentTranslate; |
|---|
| 91 |
ctx=curtrans.x; |
|---|
| 92 |
cty=curtrans.y; |
|---|
| 93 |
ttrelem.setAttribute("x",posx-ctx+10); |
|---|
| 94 |
ttrelem.setAttribute("y",posy-cty-20+10); |
|---|
| 95 |
ttrelem.setAttribute("width",maxbreite+2*(maxbreite-sollbreite)+40); |
|---|
| 96 |
ttrelem.setAttribute("height",anz*15+3); |
|---|
| 97 |
ttrelem.setAttribute("style","fill: #FFC; stroke: #000; stroke-width: 0.5px"); |
|---|
| 98 |
for(i=1;i<=anz;i++) |
|---|
| 99 |
{ |
|---|
| 100 |
texte.item(i).firstChild.data=neu[i-1]; |
|---|
| 101 |
texte.item(i).setAttribute("x",posx-ctx+15); |
|---|
| 102 |
texte.item(i).setAttribute("y",parseInt(i-1)*15+posy-cty+3); |
|---|
| 103 |
texte.item(i).setAttribute("style","fill: #00C; font-size: 11px"); |
|---|
| 104 |
} |
|---|
| 105 |
svgdoc.getElementById("tooltip").style.setProperty("visibility","visible"); |
|---|
| 106 |
} |
|---|
| 107 |
function HideTooltip() |
|---|
| 108 |
{ |
|---|
| 109 |
svgdoc.getElementById("tooltip").style.setProperty("visibility","hidden"); |
|---|
| 110 |
} |
|---|
| 111 |
function ZoomControl() |
|---|
| 112 |
{ |
|---|
| 113 |
var curzoom; |
|---|
| 114 |
curzoom=svgroot.currentScale; |
|---|
| 115 |
svgdoc.getElementById("tooltip").setAttribute("transform","scale("+1/curzoom+")"); |
|---|
| 116 |
} |
|---|
| 117 |
]]> |
|---|
| 118 |
</script> |
|---|
| 119 |
</defs> |
|---|
| 120 |
<g transform="translate(150,50) scale(0.5)"> |
|---|
| 121 |
<!--Heading--> |
|---|
| 122 |
<text x="5" y="-40" text-anchor="left" font-weight="bolder" |
|---|
| 123 |
font-size="40" fill="maroon" text-decoration="underline"> |
|---|
| 124 |
<xsl:value-of select="title"/> |
|---|
| 125 |
</text> |
|---|
| 126 |
<!--Caption (Vertical)--> |
|---|
| 127 |
<g transform="translate(-220, 80) rotate(270, 0, 0)"> |
|---|
| 128 |
<text x="0" y="0" text-anchor="middle" font-weight="bolder" |
|---|
| 129 |
font-size="36" fill="black"> |
|---|
| 130 |
<xsl:value-of select="ytitle"/> |
|---|
| 131 |
</text> |
|---|
| 132 |
</g> |
|---|
| 133 |
<g transform="translate(1220, 80) rotate(90, 0, 0)"> |
|---|
| 134 |
<text x="0" y="0" text-anchor="middle" font-weight="bolder" |
|---|
| 135 |
font-size="36" fill="black"> |
|---|
| 136 |
<xsl:value-of select="y2title"/> |
|---|
| 137 |
</text> |
|---|
| 138 |
</g> |
|---|
| 139 |
<!--Caption (Horizontal)--> |
|---|
| 140 |
<text x="1070" y="1000" font-size="36" font-weight="bolder" fill="black"> |
|---|
| 141 |
<xsl:value-of select="xtitle"/> |
|---|
| 142 |
</text> |
|---|
| 143 |
<!-- Now Draw the main X and Y axis --> |
|---|
| 144 |
<g style="stroke-width:5; stroke:black"> |
|---|
| 145 |
<!-- X Axis --> |
|---|
| 146 |
<path d="M 0 1000 L 1000 1000 Z"/> |
|---|
| 147 |
<!-- Y Axis --> |
|---|
| 148 |
<path d="M 0 0 L 0 1000 Z"/> |
|---|
| 149 |
<xsl:if test="y2axis='true'"> |
|---|
| 150 |
<!-- Y2 Axis --> |
|---|
| 151 |
<path d="M 1000 0 L 1000 1000 Z"/> |
|---|
| 152 |
</xsl:if> |
|---|
| 153 |
</g> |
|---|
| 154 |
<xsl:for-each select="sets/set"> |
|---|
| 155 |
<!-- display the x-axis labels --> |
|---|
| 156 |
<g style="stroke:red; stroke-width: 3; fill:black; stroke:none ;font-size:24; text-anchor:middle"> |
|---|
| 157 |
<xsl:for-each select="measure[xlabel]"> |
|---|
| 158 |
<!-- for all measures with an xlabel --> |
|---|
| 159 |
<xsl:call-template name="xlabel"> |
|---|
| 160 |
<xsl:with-param name="xvalue" select="xvalue"/> |
|---|
| 161 |
<xsl:with-param name="xlabel" select="xlabel"/> |
|---|
| 162 |
<xsl:with-param name="minx" select="$minx"/> |
|---|
| 163 |
<xsl:with-param name="maxx" select="$maxx"/> |
|---|
| 164 |
</xsl:call-template> |
|---|
| 165 |
</xsl:for-each> |
|---|
| 166 |
<xsl:for-each select="../../xvalues/xvalue"> |
|---|
| 167 |
<!-- for all (explicit) xvalues --> |
|---|
| 168 |
<xsl:call-template name="xlabel"> |
|---|
| 169 |
<xsl:with-param name="xvalue" select="value"/> |
|---|
| 170 |
<xsl:with-param name="xlabel" select="label"/> |
|---|
| 171 |
<xsl:with-param name="minx" select="$minx"/> |
|---|
| 172 |
<xsl:with-param name="maxx" select="$maxx"/> |
|---|
| 173 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 174 |
</xsl:call-template> |
|---|
| 175 |
</xsl:for-each> |
|---|
| 176 |
</g> |
|---|
| 177 |
<xsl:for-each select="../../xvalues/xmarkers"> |
|---|
| 178 |
<!-- draw y-markers on the vertical axis --> |
|---|
| 179 |
<xsl:call-template name="xmarker"> |
|---|
| 180 |
<xsl:with-param name="start" select="minvalue"/> |
|---|
| 181 |
<xsl:with-param name="n" select="steps"/> |
|---|
| 182 |
<xsl:with-param name="stepsize" |
|---|
| 183 |
select="(maxvalue - minvalue) div steps"/> |
|---|
| 184 |
<xsl:with-param name="min" select="$minx"/> |
|---|
| 185 |
<xsl:with-param name="max" select="$maxx"/> |
|---|
| 186 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 187 |
</xsl:call-template> |
|---|
| 188 |
</xsl:for-each> |
|---|
| 189 |
<!-- end of x-axis markers, labels and vertical grid-lines --> |
|---|
| 190 |
<!-- create the y-axis markers --> |
|---|
| 191 |
<xsl:for-each select="measure[ylabel]"> |
|---|
| 192 |
<!-- for all measures with an ylabel --> |
|---|
| 193 |
<xsl:call-template name="ylabel"> |
|---|
| 194 |
<xsl:with-param name="yvalue" select="yvalue"/> |
|---|
| 195 |
<xsl:with-param name="ylabel" select="ylabel"/> |
|---|
| 196 |
<xsl:with-param name="min" select="$min"/> |
|---|
| 197 |
<xsl:with-param name="max" select="$max"/> |
|---|
| 198 |
</xsl:call-template> |
|---|
| 199 |
</xsl:for-each> |
|---|
| 200 |
<xsl:for-each select="../../yvalues/yvalue"> |
|---|
| 201 |
<!-- for all (explicit) yvalues --> |
|---|
| 202 |
<xsl:call-template name="ylabel"> |
|---|
| 203 |
<xsl:with-param name="yvalue" select="value"/> |
|---|
| 204 |
<xsl:with-param name="ylabel" select="label"/> |
|---|
| 205 |
<xsl:with-param name="min" select="$min"/> |
|---|
| 206 |
<xsl:with-param name="max" select="$max"/> |
|---|
| 207 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 208 |
</xsl:call-template> |
|---|
| 209 |
</xsl:for-each> |
|---|
| 210 |
<xsl:for-each select="../../yvalues/ymarkers"> |
|---|
| 211 |
<!-- draw y-markers on the vertical axis --> |
|---|
| 212 |
<xsl:call-template name="ymarker"> |
|---|
| 213 |
<xsl:with-param name="start" select="minvalue"/> |
|---|
| 214 |
<xsl:with-param name="n" select="steps"/> |
|---|
| 215 |
<xsl:with-param name="stepsize" |
|---|
| 216 |
select="(maxvalue - minvalue) div steps"/> |
|---|
| 217 |
<xsl:with-param name="min" select="$min"/> |
|---|
| 218 |
<xsl:with-param name="max" select="$max"/> |
|---|
| 219 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 220 |
</xsl:call-template> |
|---|
| 221 |
</xsl:for-each> |
|---|
| 222 |
<!-- end of y-axis markers, labels and horizontal grid-lines --> |
|---|
| 223 |
<!-- create the y2-axis markers --> |
|---|
| 224 |
<xsl:for-each select="measure[y2label]"> |
|---|
| 225 |
<!-- for all measures with an ylabel --> |
|---|
| 226 |
<xsl:call-template name="ylabel"> |
|---|
| 227 |
<xsl:with-param name="yvalue" select="y2value"/> |
|---|
| 228 |
<xsl:with-param name="ylabel" select="y2label"/> |
|---|
| 229 |
<xsl:with-param name="min" select="$miny2"/> |
|---|
| 230 |
<xsl:with-param name="max" select="$maxy2"/> |
|---|
| 231 |
<xsl:with-param name="axis" select="2"/> |
|---|
| 232 |
</xsl:call-template> |
|---|
| 233 |
</xsl:for-each> |
|---|
| 234 |
<xsl:for-each select="../../y2values/y2value"> |
|---|
| 235 |
<!-- for all (explicit) yvalues --> |
|---|
| 236 |
<xsl:call-template name="ylabel"> |
|---|
| 237 |
<xsl:with-param name="yvalue" select="value"/> |
|---|
| 238 |
<xsl:with-param name="ylabel" select="label"/> |
|---|
| 239 |
<xsl:with-param name="min" select="$miny2"/> |
|---|
| 240 |
<xsl:with-param name="max" select="$maxy2"/> |
|---|
| 241 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 242 |
<xsl:with-param name="axis" select="2"/> |
|---|
| 243 |
</xsl:call-template> |
|---|
| 244 |
</xsl:for-each> |
|---|
| 245 |
<xsl:for-each select="../../y2values/y2markers"> |
|---|
| 246 |
<!-- draw y-markers on the vertical axis --> |
|---|
| 247 |
<xsl:call-template name="ymarker"> |
|---|
| 248 |
<xsl:with-param name="start" select="minvalue"/> |
|---|
| 249 |
<xsl:with-param name="n" select="steps"/> |
|---|
| 250 |
<xsl:with-param name="stepsize" |
|---|
| 251 |
select="(maxvalue - minvalue) div steps"/> |
|---|
| 252 |
<xsl:with-param name="min" select="$miny2"/> |
|---|
| 253 |
<xsl:with-param name="max" select="$maxy2"/> |
|---|
| 254 |
<xsl:with-param name="gridline" select="gridline"/> |
|---|
| 255 |
<xsl:with-param name="axis" select="2"/> |
|---|
| 256 |
</xsl:call-template> |
|---|
| 257 |
</xsl:for-each> |
|---|
| 258 |
<!-- end of y2-axis markers, labels and horizontal grid-lines --> |
|---|
| 259 |
|
|---|
| 260 |
<!-- go and draw the line of the chart itself --> |
|---|
| 261 |
<g stylet="stroke:red; stroke-width: 3; fill : none;"> |
|---|
| 262 |
<xsl:attribute name="style"> |
|---|
| 263 |
stroke:<xsl:value-of select="@color"/>;stroke-width: 3; fill : none; |
|---|
| 264 |
</xsl:attribute> |
|---|
| 265 |
<!-- instead of a polyline, make a line from the previous to each new point --> |
|---|
| 266 |
<xsl:for-each select="measure"> |
|---|
| 267 |
<xsl:variable name="x"> |
|---|
| 268 |
<xsl:value-of select=" 1000* ((xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 269 |
</xsl:variable> |
|---|
| 270 |
<xsl:variable name="y"> |
|---|
| 271 |
<xsl:choose> |
|---|
| 272 |
<xsl:when test="yvalue"> |
|---|
| 273 |
<xsl:value-of select="1000 - 1000* ((yvalue - ($min)) div ($max - $min))"/> |
|---|
| 274 |
</xsl:when> |
|---|
| 275 |
<xsl:otherwise> |
|---|
| 276 |
<xsl:value-of select="1000 - 1000* ((y2value - ($miny2)) div ($maxy2 - $miny2))"/> |
|---|
| 277 |
</xsl:otherwise> |
|---|
| 278 |
</xsl:choose> |
|---|
| 279 |
</xsl:variable> |
|---|
| 280 |
<xsl:if test="not(../@showline='false')"> |
|---|
| 281 |
<xsl:if test="(position() > 1)"> |
|---|
| 282 |
<line> |
|---|
| 283 |
<xsl:attribute name="x1"> |
|---|
| 284 |
<xsl:value-of select=" 1000* ((preceding-sibling::measure[position()=1]/xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 285 |
</xsl:attribute> |
|---|
| 286 |
<xsl:attribute name="y1"> |
|---|
| 287 |
<xsl:choose> |
|---|
| 288 |
<xsl:when test="yvalue"> |
|---|
| 289 |
<xsl:value-of select="1000 - 1000* ((preceding-sibling::measure[position()=1]/yvalue - ($min)) div ($max - $min))"/> |
|---|
| 290 |
</xsl:when> |
|---|
| 291 |
<xsl:otherwise> |
|---|
| 292 |
<xsl:value-of select="1000 - 1000* ((preceding-sibling::measure[position()=1]/y2value - ($miny2)) div ($maxy2 - $miny2))"/> |
|---|
| 293 |
</xsl:otherwise> |
|---|
| 294 |
</xsl:choose> |
|---|
| 295 |
</xsl:attribute> |
|---|
| 296 |
<xsl:attribute name="x2"> |
|---|
| 297 |
<xsl:value-of select="$x"/> |
|---|
| 298 |
</xsl:attribute> |
|---|
| 299 |
<xsl:attribute name="y2"> |
|---|
| 300 |
<xsl:value-of select="$y"/> |
|---|
| 301 |
</xsl:attribute> |
|---|
| 302 |
</line> |
|---|
| 303 |
</xsl:if> |
|---|
| 304 |
</xsl:if> |
|---|
| 305 |
<xsl:if test="xgrid = 'true'"> |
|---|
| 306 |
<xsl:call-template name="gridline"> |
|---|
| 307 |
<xsl:with-param name="x1" select="$x"/> |
|---|
| 308 |
<xsl:with-param name="y1" select="$y"/> |
|---|
| 309 |
<xsl:with-param name="type">vertical</xsl:with-param> |
|---|
| 310 |
</xsl:call-template> |
|---|
| 311 |
</xsl:if> |
|---|
| 312 |
<xsl:if test="ygrid = 'true'"> |
|---|
| 313 |
<xsl:call-template name="gridline"> |
|---|
| 314 |
<xsl:with-param name="x1" select="$x"/> |
|---|
| 315 |
<xsl:with-param name="y1" select="$y"/> |
|---|
| 316 |
<xsl:with-param name="type">horizontal</xsl:with-param> |
|---|
| 317 |
<xsl:with-param name="yaxis"> |
|---|
| 318 |
<xsl:choose> |
|---|
| 319 |
<xsl:when test="yvalue">1</xsl:when> |
|---|
| 320 |
<xsl:otherwise>2</xsl:otherwise> |
|---|
| 321 |
</xsl:choose> |
|---|
| 322 |
</xsl:with-param> |
|---|
| 323 |
</xsl:call-template> |
|---|
| 324 |
</xsl:if> |
|---|
| 325 |
</xsl:for-each> <!-- measure --> |
|---|
| 326 |
</g> |
|---|
| 327 |
</xsl:for-each> <!-- sets --> |
|---|
| 328 |
<!-- now again traverse all measures to place markers and create annotations; |
|---|
| 329 |
by doing this in a second go, we ensure (according to the 'painters algoritm' |
|---|
| 330 |
(see: http://wiki.svg.org/index.php/ChangingDrawingOrder)) that the annotations |
|---|
| 331 |
and markers are on top of everything else. |
|---|
| 332 |
--> |
|---|
| 333 |
<xsl:for-each select="sets/set"> |
|---|
| 334 |
<xsl:for-each select="measure"> |
|---|
| 335 |
<xsl:variable name="x"> |
|---|
| 336 |
<xsl:value-of select=" 1000* ((xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 337 |
</xsl:variable> |
|---|
| 338 |
<xsl:variable name="y"> |
|---|
| 339 |
<xsl:choose> |
|---|
| 340 |
<xsl:when test="yvalue"> |
|---|
| 341 |
<xsl:value-of select="1000 - 1000* ((yvalue - ($min)) div ($max - $min))"/> |
|---|
| 342 |
</xsl:when> |
|---|
| 343 |
<xsl:otherwise> |
|---|
| 344 |
<xsl:value-of select="1000 - 1000* ((y2value - ($miny2)) div ($maxy2 - $miny2))"/> |
|---|
| 345 |
</xsl:otherwise> |
|---|
| 346 |
</xsl:choose> |
|---|
| 347 |
</xsl:variable> |
|---|
| 348 |
<g > |
|---|
| 349 |
<xsl:attribute name="style">stroke:<xsl:value-of select="../@color"/> stroke-width: 3; fill : none;</xsl:attribute> |
|---|
| 350 |
<!-- draw a marker --> |
|---|
| 351 |
<xsl:call-template name="marker"> |
|---|
| 352 |
<xsl:with-param name="x" select="$x"/> |
|---|
| 353 |
<xsl:with-param name="y" select="$y"/> |
|---|
| 354 |
<xsl:with-param name="label" select="label"/> |
|---|
| 355 |
<xsl:with-param name="marker" select="../@marker-type"/> |
|---|
| 356 |
<xsl:with-param name="color" select="../@color"/> |
|---|
| 357 |
</xsl:call-template> |
|---|
| 358 |
<xsl:if test="annotation"> |
|---|
| 359 |
<!-- currently the annotation is written before the line ; that means that the line will cover the annotation --> |
|---|
| 360 |
<xsl:call-template name="annotation"> |
|---|
| 361 |
<xsl:with-param name="x" select="$x"/> |
|---|
| 362 |
<xsl:with-param name="y" select="$y"/> |
|---|
| 363 |
<xsl:with-param name="annotation" select="annotation"/> |
|---|
| 364 |
</xsl:call-template> |
|---|
| 365 |
</xsl:if> |
|---|
| 366 |
</g> |
|---|
| 367 |
</xsl:for-each> <!-- measures in set --> |
|---|
| 368 |
</xsl:for-each> <!-- sets --> |
|---|
| 369 |
<!-- legend per set --> |
|---|
| 370 |
<g id="legend" style="fill:lavenderblush;stroke-width:2;stroke:black" transform="translate(1080,500)"> |
|---|
| 371 |
<!-- Tooltip - Beginn (ttr=Tooltip-Rechteck, ttt=Tooltip-Text) --> |
|---|
| 372 |
<rect id="legend" x="0" y="0" rx="5" ry="5" width="200" > |
|---|
| 373 |
<xsl:attribute name="height"><xsl:value-of select="29+ 20* count(sets/set)"/></xsl:attribute> |
|---|
| 374 |
</rect> |
|---|
| 375 |
<text x="10" y="15" style="text-decoration:underline;stroke-width:1;stroke:black;fill:black">Legend:</text> |
|---|
| 376 |
<xsl:for-each select="sets/set"> |
|---|
| 377 |
<xsl:call-template name="marker"> |
|---|
| 378 |
<xsl:with-param name="x">15</xsl:with-param> |
|---|
| 379 |
<xsl:with-param name="y" select="7+20*(position())"/> |
|---|
| 380 |
<xsl:with-param name="label" select="title"/> |
|---|
| 381 |
<xsl:with-param name="marker" select="@marker-type"/> |
|---|
| 382 |
<xsl:with-param name="color" select="@color"/> |
|---|
| 383 |
</xsl:call-template> |
|---|
| 384 |
<text x="27"> |
|---|
| 385 |
<xsl:attribute name="y"><xsl:value-of select="15+20*(position())"/></xsl:attribute> |
|---|
| 386 |
<xsl:attribute name="style">stroke-width:1;stroke:<xsl:value-of select="@color" />;fill:<xsl:value-of select="@color" /></xsl:attribute> |
|---|
| 387 |
<xsl:value-of select="@title"/> |
|---|
| 388 |
</text> |
|---|
| 389 |
</xsl:for-each> |
|---|
| 390 |
</g> |
|---|
| 391 |
|
|---|
| 392 |
</g> |
|---|
| 393 |
<g id="tooltip" style="visibility: hidden"> |
|---|
| 394 |
<!-- Tooltip - Beginn (ttr=Tooltip-Rechteck, ttt=Tooltip-Text) --> |
|---|
| 395 |
<rect id="ttr" x="0" y="0" rx="5" ry="5" width="100" height="16"/> |
|---|
| 396 |
<text id="ttt" x="0" y="0" style="visibility: hidden">dyn. Text</text> |
|---|
| 397 |
<text x="-10" y="-10">dyn. Text</text> |
|---|
| 398 |
<text x="-10" y="-10">dyn. Text</text> |
|---|
| 399 |
<text x="-10" y="-10">dyn. Text</text> |
|---|
| 400 |
<text x="-10" y="-10">dyn. Text</text> |
|---|
| 401 |
<text x="-10" y="-10">dyn. Text</text> |
|---|
| 402 |
</g> |
|---|
| 403 |
<!-- Tooltip - Ende --> |
|---|
| 404 |
</svg> |
|---|
| 405 |
</xsl:template> |
|---|
| 406 |
<xsl:template name="xlabel"> |
|---|
| 407 |
<xsl:param name="xvalue"/> |
|---|
| 408 |
<xsl:param name="maxx"/> |
|---|
| 409 |
<xsl:param name="minx"/> |
|---|
| 410 |
<xsl:param name="xlabel"/> |
|---|
| 411 |
<xsl:param name="gridline"/> |
|---|
| 412 |
<g> |
|---|
| 413 |
<xsl:attribute name="transform">rotate(315, |
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
<xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
,1014)</xsl:attribute> |
|---|
| 420 |
<text y="1014" style="text-anchor:end"> |
|---|
| 421 |
<xsl:attribute name="x"> |
|---|
| 422 |
<xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 423 |
</xsl:attribute> |
|---|
| 424 |
<xsl:value-of select="$xlabel"/> |
|---|
| 425 |
</text> |
|---|
| 426 |
</g> |
|---|
| 427 |
<xsl:if test="$gridline = 'true'"> |
|---|
| 428 |
<xsl:call-template name="gridline"> |
|---|
| 429 |
<xsl:with-param name="x1"> |
|---|
| 430 |
<xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> |
|---|
| 431 |
</xsl:with-param> |
|---|
| 432 |
<xsl:with-param name="y1">0</xsl:with-param> |
|---|
| 433 |
<xsl:with-param name="type">vertical</xsl:with-param> |
|---|
| 434 |
</xsl:call-template> |
|---|
| 435 |
</xsl:if> |
|---|
| 436 |
</xsl:template> |
|---|
| 437 |
<!-- xlabel --> |
|---|
| 438 |
<xsl:template name="ylabel"> |
|---|
| 439 |
<xsl:param name="yvalue"/> |
|---|
| 440 |
<xsl:param name="max"/> |
|---|
| 441 |
<xsl:param name="min"/> |
|---|
| 442 |
<xsl:param name="ylabel"/> |
|---|
| 443 |
<xsl:param name="gridline"/> |
|---|
| 444 |
<xsl:param name="axis">1</xsl:param> |
|---|
| 445 |
<g id="ylabel"> |
|---|
| 446 |
<xsl:attribute name="transform">rotate(<xsl:value-of select="325 + ($axis - 1) * -300 "/>, <xsl:value-of select="-10 + ($axis - 1) * 1020 "/>, |
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
<xsl:value-of select="1000-1000* (($yvalue - ($min)) div ($max - $min))"/> |
|---|
| 450 |
|
|---|
| 451 |
)</xsl:attribute> |
|---|
| 452 |
<text x="-10" font-size="20pt"> |
|---|
| 453 |
<xsl:attribute name="style">text-anchor: |
|---|
| 454 |
<xsl:choose> |
|---|
| 455 |
<xsl:when test="$axis=1">end</xsl:when> |
|---|
| 456 |
<xsl:otherwise>start</xsl:otherwise> |
|---|
| 457 |
</xsl:choose> |
|---|
| 458 |
</xsl:attribute> |
|---|
| 459 |
<xsl:attribute name="x"> |
|---|
| 460 |
<xsl:value-of select="-10 + ($axis - 1) * 1020 "/> |
|---|
| 461 |
</xsl:attribute> |
|---|
| 462 |
<xsl:attribute name="y"> |
|---|
| 463 |
<xsl:value-of select="1000 - 1000* (($yvalue - ($min)) div ($max - $min))"/> |
|---|
| 464 |
</xsl:attribute> |
|---|
| 465 |
<xsl:value-of select="$ylabel"/> |
|---|
| 466 |
</text> |
|---|
| 467 |
</g> |
|---|
| 468 |
<xsl:if test="$gridline = 'true'"> |
|---|
| 469 |
<xsl:call-template name="gridline"> |
|---|
| 470 |
<xsl:with-param name="y1"> |
|---|
| 471 |
<xsl:value-of select="1000 - 1000* (($yvalue - ($min)) div ($max - $min))"/> |
|---|
| 472 |
</xsl:with-param> |
|---|
| 473 |
<xsl:with-param name="x1"><xsl:value-of select="1000- 1000*($axis -1 )" /></xsl:with-param> |
|---|
| 474 |
<xsl:with-param name="type">horizontal</xsl:with-param> |
|---|
| 475 |
<xsl:with-param name="yaxis"><xsl:value-of select="$axis" /></xsl:with-param> |
|---|
| 476 |
</xsl:call-template> |
|---|
| 477 |
</xsl:if> |
|---|
| 478 |
</xsl:template> |
|---|
| 479 |
<!-- ylabel --> |
|---|
| 480 |
<xsl:template name="annotation"> |
|---|
| 481 |
<xsl:param name="x"/> |
|---|
| 482 |
<xsl:param name="y"/> |
|---|
| 483 |
<xsl:param name="annotation"/> |
|---|
| 484 |
<!-- display an annotation --> |
|---|
| 485 |
<g style="stroke-width:1;stroke:blue"> |
|---|
| 486 |
<xsl:variable name="height"> |
|---|
| 487 |
<xsl:value-of select="8+16*round(string-length($annotation) div 25)"/> |
|---|
| 488 |
</xsl:variable> |
|---|
| 489 |
<xsl:variable name="y_anno"> |
|---|
| 490 |
<xsl:choose> |
|---|
| 491 |
<xsl:when test="$y < 300">-150</xsl:when> |
|---|
| 492 |
<xsl:otherwise>150</xsl:otherwise> |
|---|
| 493 |
</xsl:choose> |
|---|
| 494 |
</xsl:variable> |
|---|
| 495 |
<xsl:variable name="line_y"> |
|---|
| 496 |
<xsl:choose> |
|---|
| 497 |
<xsl:when test="$y < 300"><xsl:value-of select="-40+ $y - $y_anno + 0.35* $height" /></xsl:when> |
|---|
| 498 |
<xsl:otherwise><xsl:value-of select="-40+ $y - $y_anno + 0.65* $height"/></xsl:otherwise> |
|---|
| 499 |
</xsl:choose> |
|---|
| 500 |
</xsl:variable> |
|---|
| 501 |
<line> |
|---|
| 502 |
<!-- vertical line either upwards (default) or downwards (for the over the 70% of max values --> |
|---|
| 503 |
<xsl:attribute name="x1"> |
|---|
| 504 |
<xsl:value-of select="$x"/> |
|---|
| 505 |
</xsl:attribute> |
|---|
| 506 |
<xsl:attribute name="y1"> |
|---|
| 507 |
<xsl:value-of select="$y"/> |
|---|
| 508 |
</xsl:attribute> |
|---|
| 509 |
<xsl:attribute name="x2"> |
|---|
| 510 |
<xsl:value-of select="$x"/> |
|---|
| 511 |
</xsl:attribute> |
|---|
| 512 |
<xsl:attribute name="y2"> |
|---|
| 513 |
<xsl:value-of select="$line_y "/> |
|---|
| 514 |
</xsl:attribute> |
|---|
| 515 |
</line> |
|---|
| 516 |
<line> |
|---|
| 517 |
<!-- horizontal line to right (default) or left (for the over 80% of max x values --> |
|---|
| 518 |
<xsl:attribute name="x1"> |
|---|
| 519 |
<xsl:value-of select="$x"/> |
|---|
| 520 |
</xsl:attribute> |
|---|
| 521 |
<xsl:attribute name="y1"> |
|---|
| 522 |
<xsl:value-of select="$line_y "/> |
|---|
| 523 |
</xsl:attribute> |
|---|
| 524 |
<xsl:attribute name="x2"> |
|---|
| 525 |
<xsl:choose> |
|---|
| 526 |
<xsl:when test="$x > 750"><xsl:value-of select="-7+$x"/></xsl:when> |
|---|
| 527 |
<xsl:otherwise><xsl:value-of select="7+$x"/></xsl:otherwise> |
|---|
| 528 |
</xsl:choose> |
|---|
| 529 |
</xsl:attribute> |
|---|
| 530 |
<xsl:attribute name="y2"> |
|---|
| 531 |
<xsl:value-of select="$line_y"/> |
|---|
| 532 |
</xsl:attribute> |
|---|
| 533 |
</line> |
|---|
| 534 |
<rect width="210" style="fill:lightyellow" > |
|---|
| 535 |
<!-- box to hold the annotation; starts at the horizontal line and extends to the right (default) or left (for over 80% of max x value --> |
|---|
| 536 |
<xsl:attribute name="height"> |
|---|
| 537 |
<xsl:value-of select="$height"/> |
|---|
| 538 |
</xsl:attribute> |
|---|
| 539 |
<xsl:attribute name="x"> |
|---|
| 540 |
<xsl:choose> |
|---|
| 541 |
<xsl:when test="$x > 750"><xsl:value-of select="-7+$x -210"/></xsl:when> |
|---|
| 542 |
<xsl:otherwise><xsl:value-of select="7+$x"/></xsl:otherwise> |
|---|
| 543 |
</xsl:choose> |
|---|
| 544 |
</xsl:attribute> |
|---|
| 545 |
<xsl:attribute name="y"> |
|---|
| 546 |
<xsl:value-of select="-40+$y - $y_anno"/> |
|---|
| 547 |
</xsl:attribute> |
|---|
| 548 |
</rect> |
|---|
| 549 |
<!-- we may need to split the text in multiple lines; our annotation textbox has a width of 40 which means around 17 characters??--> |
|---|
| 550 |
<xsl:call-template name="annotationLine"> |
|---|
| 551 |
<xsl:with-param name="x" select="$x"/> |
|---|
| 552 |
<xsl:with-param name="y" select="$y - $y_anno"/> |
|---|
| 553 |
<xsl:with-param name="annotation" select="$annotation"/> |
|---|
| 554 |
<xsl:with-param name="line">1</xsl:with-param> |
|---|
| 555 |
</xsl:call-template> |
|---|
| 556 |
</g> |
|---|
| 557 |
</xsl:template> |
|---|
| 558 |
<xsl:template name="marker"> |
|---|
| 559 |
<xsl:param name="x"/> |
|---|
| 560 |
<xsl:param name="y"/> |
|---|
| 561 |
<xsl:param name="label"/> |
|---|
| 562 |
<xsl:param name="marker">circle</xsl:param> |
|---|
| 563 |
<xsl:param name="color">red</xsl:param> |
|---|
| 564 |
<g onmouseout="HideTooltip(evt)" transform="scale(1)"> |
|---|
| 565 |
<xsl:attribute name="style"> |
|---|
| 566 |
stroke:<xsl:value-of select="$color"/>;fill:<xsl:value-of select="$color"/> |
|---|
| 567 |
</xsl:attribute> |
|---|
| 568 |
<xsl:attribute name="onmouseover"> |
|---|
| 569 |
ShowTooltip(evt,'<xsl:value-of select="$label"/>') |
|---|
| 570 |
</xsl:attribute> |
|---|
| 571 |
<xsl:choose> |
|---|
| 572 |
<xsl:when test="$marker='square'"> |
|---|
| 573 |
<use xlink:href="#square"> |
|---|
| 574 |
<xsl:attribute name="x"> |
|---|
| 575 |
<xsl:value-of select="$x -9"/> |
|---|
| 576 |
</xsl:attribute> |
|---|
| 577 |
<xsl:attribute name="y"> |
|---|
| 578 |
<xsl:value-of select="$y -9"/> |
|---|
| 579 |
</xsl:attribute> |
|---|
| 580 |
</use> |
|---|
| 581 |
</xsl:when> |
|---|
| 582 |
<xsl:when test="$marker='triangle'"> |
|---|
| 583 |
<use xlink:href="#triangle"> |
|---|
| 584 |
<xsl:attribute name="x"> |
|---|
| 585 |
<xsl:value-of select="$x -9"/> |
|---|
| 586 |
</xsl:attribute> |
|---|
| 587 |
<xsl:attribute name="y"> |
|---|
| 588 |
<xsl:value-of select="$y -9"/> |
|---|
| 589 |
</xsl:attribute> |
|---|
| 590 |
</use> |
|---|
| 591 |
</xsl:when> |
|---|
| 592 |
<xsl:when test="$marker='rectangle'"> |
|---|
| 593 |
<use xlink:href="#rectangle"> |
|---|
| 594 |
<xsl:attribute name="x"> |
|---|
| 595 |
<xsl:value-of select="$x -4"/> |
|---|
| 596 |
</xsl:attribute> |
|---|
| 597 |
<xsl:attribute name="y"> |
|---|
| 598 |
<xsl:value-of select="$y -4"/> |
|---|
| 599 |
</xsl:attribute> |
|---|
| 600 |
</use> |
|---|
| 601 |
</xsl:when> |
|---|
| 602 |
<xsl:when test="$marker='star'"> |
|---|
| 603 |
<use xlink:href="#star"> |
|---|
| 604 |
<xsl:attribute name="x"> |
|---|
| 605 |
<xsl:value-of select="$x -9"/> |
|---|
| 606 |
</xsl:attribute> |
|---|
| 607 |
<xsl:attribute name="y"> |
|---|
| 608 |
<xsl:value-of select="$y -9"/> |
|---|
| 609 |
</xsl:attribute> |
|---|
| 610 |
</use> |
|---|
| 611 |
</xsl:when> |
|---|
| 612 |
<xsl:when test="$marker='diamond'"> |
|---|
| 613 |
<!-- diamond is just a square rotated about its own center for 45 degrees --> |
|---|
| 614 |
<use xlink:href="#square"> |
|---|
| 615 |
<xsl:attribute name="x"> |
|---|
| 616 |
<xsl:value-of select="$x -9"/> |
|---|
| 617 |
</xsl:attribute> |
|---|
| 618 |
<xsl:attribute name="y"> |
|---|
| 619 |
<xsl:value-of select="$y -9"/> |
|---|
| 620 |
</xsl:attribute> |
|---|
| 621 |
<xsl:attribute name="transform"> |
|---|
| 622 |
rotate(45,<xsl:value-of select="$x"/>,<xsl:value-of select="$y "/>) |
|---|
| 623 |
</xsl:attribute> |
|---|
| 624 |
</use> |
|---|
| 625 |
</xsl:when> |
|---|
| 626 |
<xsl:when test="$marker='circle'"> |
|---|
| 627 |
<circle r="9"> |
|---|
| 628 |
<xsl:attribute name="cx"> |
|---|
| 629 |
<xsl:value-of select="$x"/> |
|---|
| 630 |
</xsl:attribute> |
|---|
| 631 |
<xsl:attribute name="cy"> |
|---|
| 632 |
<xsl:value-of select="$y"/> |
|---|
| 633 |
</xsl:attribute> |
|---|
| 634 |
</circle> |
|---|
| 635 |
</xsl:when> |
|---|
| 636 |
<xsl:when test="$marker='smallcircle'"> |
|---|
| 637 |
<circle r="4"> |
|---|
| 638 |
<xsl:attribute name="cx"> |
|---|
| 639 |
<xsl:value-of select="$x"/> |
|---|
| 640 |
</xsl:attribute> |
|---|
| 641 |
<xsl:attribute name="cy"> |
|---|
| 642 |
<xsl:value-of select="$y"/> |
|---|
| 643 |
</xsl:attribute> |
|---|
| 644 |
</circle> |
|---|
| 645 |
</xsl:when> |
|---|
| 646 |
<xsl:otherwise> |
|---|
| 647 |
</xsl:otherwise> |
|---|
| 648 |
</xsl:choose> |
|---|
| 649 |
</g> |
|---|
| 650 |
</xsl:template> |
|---|
| 651 |
<xsl:template name="xmarker"> |
|---|
| 652 |
<xsl:param name="n"/> |
|---|
| 653 |
<xsl:param name="i">0</xsl:param> |
|---|
| 654 |
<xsl:param name="stepsize"/> |
|---|
| 655 |
<xsl:param name="min"/> |
|---|
| 656 |
<xsl:param name="max"/> |
|---|
| 657 |
<xsl:param name="gridline">false</xsl:param> |
|---|
| 658 |
<xsl:param name="start"> |
|---|
| 659 |
<xsl:value-of select="$min"/> |
|---|
| 660 |
</xsl:param> |
|---|
| 661 |
<xsl:variable name="x"> |
|---|
| 662 |
<xsl:value-of select="1000* (($start + $i* $stepsize - $min) div ($max - $min))"/> |
|---|
| 663 |
</xsl:variable> |
|---|
| 664 |
<line y1="1000" y2="985"> |
|---|
| 665 |
<xsl:attribute name="x1"> |
|---|
| 666 |
<xsl:value-of select="$x"/> |
|---|
| 667 |
</xsl:attribute> |
|---|
| 668 |
<xsl:attribute name="x2"> |
|---|
| 669 |
<xsl:value-of select="$x"/> |
|---|
| 670 |
</xsl:attribute> |
|---|
| 671 |
</line> |
|---|
| 672 |
<xsl:call-template name="xlabel"> |
|---|
| 673 |
<xsl:with-param name="xvalue" select="$start + $i* $stepsize"/> |
|---|
| 674 |
<xsl:with-param name="xlabel"> |
|---|
| 675 |
<xsl:value-of select="round($i * $stepsize +$start)"/> |
|---|
| 676 |
"</xsl:with-param> |
|---|
| 677 |
<xsl:with-param name="minx" select="$min"/> |
|---|
| 678 |
<xsl:with-param name="maxx" select="$max"/> |
|---|
| 679 |
</xsl:call-template> |
|---|
| 680 |
<xsl:if test="$gridline = 'true'"> |
|---|
| 681 |
<xsl:call-template name="gridline"> |
|---|
| 682 |
<xsl:with-param name="y1">0</xsl:with-param> |
|---|
| 683 |
<xsl:with-param name="x1" select="$x"/> |
|---|
| 684 |
<xsl:with-param name="type">vertical</xsl:with-param> |
|---|
| 685 |
</xsl:call-template> |
|---|
| 686 |
</xsl:if> |
|---|
| 687 |
<xsl:if test="$i < $n"> |
|---|
| 688 |
<xsl:call-template name="xmarker"> |
|---|
| 689 |
<xsl:with-param name="i" select="$i+1"/> |
|---|
| 690 |
<xsl:with-param name="n" select="$n"/> |
|---|
| 691 |
<xsl:with-param name="stepsize" select="$stepsize"/> |
|---|
| 692 |
<xsl:with-param name="min" select="$min"/> |
|---|
| 693 |
<xsl:with-param name="max" select="$max"/> |
|---|
| 694 |
<xsl:with-param name="start" select="$start"/> |
|---|
| 695 |
<xsl:with-param name="gridline" select="$gridline"/> |
|---|
| 696 |
</xsl:call-template> |
|---|
| 697 |
</xsl:if> |
|---|
| 698 |
</xsl:template> |
|---|
| 699 |
<!-- end of xmarker --> |
|---|
| 700 |
<xsl:template name="ymarker"> |
|---|
| 701 |
<xsl:param name="n"/> |
|---|
| 702 |
<xsl:param name="i">0</xsl:param> |
|---|
| 703 |
<xsl:param name="stepsize"/> |
|---|
| 704 |
<xsl:param name="min"/> |
|---|
| 705 |
<xsl:param name="max"/> |
|---|
| 706 |
<xsl:param name="gridline">false</xsl:param> |
|---|
| 707 |
<xsl:param name="start"> |
|---|
| 708 |
<xsl:value-of select="$min"/> |
|---|
| 709 |
</xsl:param> |
|---|
| 710 |
<xsl:param name="axis">1</xsl:param> |
|---|
| 711 |
<xsl:variable name="y"> |
|---|
| 712 |
<xsl:value-of select="1000 - 1000* (($start + $i* $stepsize - $min) div ($max - $min))"/> |
|---|
| 713 |
</xsl:variable> |
|---|
| 714 |
<xsl:value-of select="$i"/> |
|---|
| 715 |
<line x1="0" x2="18"> |
|---|
| 716 |
<xsl:attribute name="y1"> |
|---|
| 717 |
<xsl:value-of select="$y"/> |
|---|
| 718 |
</xsl:attribute> |
|---|
| 719 |
<xsl:attribute name="y2"> |
|---|
| 720 |
<xsl:value-of select="$y"/> |
|---|
| 721 |
</xsl:attribute> |
|---|
| 722 |
</line> |
|---|
| 723 |
<text x="-20"> |
|---|
| 724 |
<xsl:attribute name="x"> |
|---|
| 725 |
<xsl:value-of select="-20 + 1030*($axis -1)"/> |
|---|
| 726 |
</xsl:attribute> |
|---|
| 727 |
<xsl:attribute name="style">text-anchor: |
|---|
| 728 |
<xsl:choose> |
|---|
| 729 |
<xsl:when test="$axis=1">end</xsl:when> |
|---|
| 730 |
<xsl:otherwise>start</xsl:otherwise> |
|---|
| 731 |
</xsl:choose> |
|---|
| 732 |
;font-size: |
|---|
| 733 |
<xsl:choose> |
|---|
| 734 |
<xsl:when test="$i=$n">40</xsl:when> |
|---|
| 735 |
<xsl:when test="$i=0">40</xsl:when> |
|---|
| 736 |
<xsl:otherwise>20</xsl:otherwise> |
|---|
| 737 |
</xsl:choose> |
|---|
| 738 |
</xsl:attribute> |
|---|
| 739 |
<xsl:attribute name="y"> |
|---|
| 740 |
<xsl:value-of select="$y +5"/> |
|---|
| 741 |
</xsl:attribute> |
|---|
| 742 |
<xsl:value-of select="round($i * $stepsize +$start)"/> |
|---|
| 743 |
</text> |
|---|
| 744 |
<xsl:if test="$gridline = 'true'"> |
|---|
| 745 |
<xsl:call-template name="gridline"> |
|---|
| 746 |
<xsl:with-param name="x1"><xsl:value-of select="1000 - 1000*( $axis -1)"/></xsl:with-param> |
|---|
| 747 |
<xsl:with-param name="y1" select="$y"/> |
|---|
| 748 |
<xsl:with-param name="type">horizontal</xsl:with-param> |
|---|
| 749 |
<xsl:with-param name="yaxis"><xsl:value-of select="$axis"/></xsl:with-param> |
|---|
| 750 |
</xsl:call-template> |
|---|
| 751 |
</xsl:if> |
|---|
| 752 |
<xsl:if test="$i < $n"> |
|---|
| 753 |
<xsl:call-template name="ymarker"> |
|---|
| 754 |
<xsl:with-param name="i" select="$i+1"/> |
|---|
| 755 |
<xsl:with-param name="n" select="$n"/> |
|---|
| 756 |
<xsl:with-param name="stepsize" select="$stepsize"/> |
|---|
| 757 |
<xsl:with-param name="min" select="$min"/> |
|---|
| 758 |
<xsl:with-param name="max" select="$max"/> |
|---|
| 759 |
<xsl:with-param name="start" select="$start"/> |
|---|
| 760 |
<xsl:with-param name="gridline" select="$gridline"/> |
|---|
| 761 |
<xsl:with-param name="axis" select="$axis"/> |
|---|
| 762 |
</xsl:call-template> |
|---|
| 763 |
</xsl:if> |
|---|
| 764 |
</xsl:template> |
|---|
| 765 |
<!-- ymarker --> |
|---|
| 766 |
<xsl:template name="gridline"> |
|---|
| 767 |
<xsl:param name="x1"/> |
|---|
| 768 |
<xsl:param name="y1"/> |
|---|
| 769 |
<xsl:param name="type"/> |
|---|
| 770 |
<xsl:param name="yaxis">1</xsl:param> |
|---|
| 771 |
<line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4"> |
|---|
| 772 |
<xsl:attribute name="x1"> |
|---|
| 773 |
<xsl:value-of select="$x1"/> |
|---|
| 774 |
</xsl:attribute> |
|---|
| 775 |
<xsl:choose> |
|---|
| 776 |
<xsl:when test="$type='horizontal'"> |
|---|
| 777 |
<xsl:attribute name="x2"><xsl:value-of select="($yaxis -1)* 1000 "/></xsl:attribute> |
|---|
| 778 |
<xsl:attribute name="y2"> |
|---|
| 779 |
<xsl:value-of select="$y1"/> |
|---|
| 780 |
</xsl:attribute> |
|---|
| 781 |
</xsl:when> |
|---|
| 782 |
<xsl:otherwise> |
|---|
| 783 |
<xsl:attribute name="y2">1000</xsl:attribute> |
|---|
| 784 |
<xsl:attribute name="x2"> |
|---|
| 785 |
<xsl:value-of select="$x1"/> |
|---|
| 786 |
</xsl:attribute> |
|---|
| 787 |
</xsl:otherwise> |
|---|
| 788 |
</xsl:choose> |
|---|
| 789 |
<xsl:attribute name="y1"> |
|---|
| 790 |
<xsl:value-of select="$y1"/> |
|---|
| 791 |
</xsl:attribute> |
|---|
| 792 |
</line> |
|---|
| 793 |
</xsl:template> |
|---|
| 794 |
<!-- gridline --> |
|---|
| 795 |
|
|---|
| 796 |
<!-- write line in annotation box --> |
|---|
| 797 |
<xsl:template name="annotationLine" > |
|---|
| 798 |
<xsl:param name="x"/> |
|---|
| 799 |
<xsl:param name="y"/> |
|---|
| 800 |
<xsl:param name="annotation"/> |
|---|
| 801 |
<xsl:param name="line">1</xsl:param> |
|---|
| 802 |
<text font-size="16" fill="black"> |
|---|
| 803 |
<xsl:attribute name="text-anchor"> |
|---|
| 804 |
<xsl:choose> |
|---|
| 805 |
<xsl:when test="$x > 750">end</xsl:when> |
|---|
| 806 |
<xsl:otherwise>start</xsl:otherwise> |
|---|
| 807 |
</xsl:choose> |
|---|
| 808 |
</xsl:attribute> |
|---|
| 809 |
<xsl:attribute name="x"> |
|---|
| 810 |
<xsl:choose> |
|---|
| 811 |
<xsl:when test="$x > 750"><xsl:value-of select="-10+$x"/></xsl:when> |
|---|
| 812 |
<xsl:otherwise><xsl:value-of select="10+$x"/></xsl:otherwise> |
|---|
| 813 |
</xsl:choose> |
|---|
| 814 |
</xsl:attribute> |
|---|
| 815 |
<xsl:attribute name="y"> |
|---|
| 816 |
<xsl:value-of select="-25+$y +16*($line -1)"/> |
|---|
| 817 |
</xsl:attribute> |
|---|
| 818 |
<xsl:value-of select="substring($annotation,1,25)"/> |
|---|
| 819 |
</text> |
|---|
| 820 |
<xsl:if test="string-length($annotation) > 25"> |
|---|
| 821 |
<xsl:call-template name="annotationLine"> |
|---|
| 822 |
<xsl:with-param name="x" select="$x"/> |
|---|
| 823 |
<xsl:with-param name="y" select="$y"/> |
|---|
| 824 |
<xsl:with-param name="annotation" select="substring($annotation,26)"/> |
|---|
| 825 |
<xsl:with-param name="line" select="$line+1"/> |
|---|
| 826 |
</xsl:call-template> |
|---|
| 827 |
</xsl:if> |
|---|
| 828 |
</xsl:template> |
|---|
| 829 |
|
|---|
| 830 |
</xsl:stylesheet> |
|---|