| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Original Author: Frankline Francis
- Copyright (c) 2012, Imaginea. All rights reserved.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND DEVELOPERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT OWNER OR DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Redistribution and use, with or without modification, are permitted provided that the following conditions are met:
- # Redistribution of source code must retain the above copyright notice, this list of conditions and the disclaimer.
- # Neither the name of Imaginea nor the names of the developers may be used to endorse or promote products derived from
- this software without specific prior written permission.
- -->
- <xsl:stylesheet version="2.0"
- xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:import href="common.xsl" />
- <xsl:import href="../../default_db_xml_cache.public/default_db/dateTime.xsl"/>
- <!-- Constants -->
- <xsl:variable name="MIN_VERTICAL_SPAN" select="75" />
- <xsl:template name="p5gnuplot:SvgCharts4Xsl" >
- <!--<xsl:param name="xData" />-->
- <xsl:param name="xData.name" />
- <xsl:param name="xData.postition"/>
- <xsl:param name="yData" />
- <xsl:param name="y2Data" />
- <xsl:param name="yData.attr" />
- <xsl:param name="yData.attr.title"/>
- <xsl:param name="y2Data.attr" />
- <xsl:param name="y2Data.attr.title"/>
- <xsl:param name="width" select="'50%'" />
- <xsl:param name="height" select="'50%'" />
- <xsl:param name="viewBoxWidth" select="300" />
- <xsl:param name="viewBoxHeight" select="300" />
- <xsl:param name="barWidth" select="30" />
- <xsl:param name="leftPadding" select="50" />
- <xsl:param name="rightPadding" select="10" />
- <xsl:param name="topPadding" select="25" />
- <xsl:param name="verticalSpan" select="100" />
-
- <!--<xsl:variable name="xCount" select="count($xData)" />-->
- <xsl:variable name="xData.name.Count" select="count($xData.name)" />
- <xsl:variable name="xData.postition.Count" select="count($xData.postition)" />
- <xsl:variable name="yCount" >
- <xsl:choose>
- <xsl:when test="$yData">
- <xsl:value-of select="count($yData)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="count($yData.attr)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="y2Count" >
- <xsl:choose>
- <xsl:when test="$y2Data">
- <xsl:value-of select="count($y2Data)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="count($y2Data.attr)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="yAllCount" select="(($yCount+$y2Count) div 2)" />
-
-
- <xsl:variable name="Data.analyzed" >
- <Data.analyzed>
- <xsl:for-each select="$xData.name">
- <xData.name pos="{position()}">
- <xsl:value-of select="text()"/>
- </xData.name>
- </xsl:for-each>
- <xsl:for-each select="$xData.postition">
- <xData.postition pos="{position()}">
- <xsl:choose>
- <xsl:when test="min($xData.postition) = number(.)">
- <xsl:attribute name="min" select="number(.)"/>
- <xsl:attribute name="minX" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="max($xData.postition) = number(.)">
- <xsl:attribute name="min" select="number(.)"/>
- <xsl:attribute name="maxX" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- <xsl:value-of select="."/>
- </xData.postition>
- </xsl:for-each>
-
-
- <xsl:choose>
- <xsl:when test="$yData">
- <xsl:for-each select="$yData">
- <yData.postition pos="{position()}">
- <xsl:choose>
- <xsl:when test="min($yData/number(.)) = number(.)">
- <xsl:attribute name="min" select="number(.)"/>
- <xsl:choose>
- <xsl:when test="number(.) <=min($y2Data/number(.))">
- <xsl:attribute name="minY" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="max($yData/number(text())) = number(.)">
- <xsl:attribute name="max" select="number(.)"/>
- <xsl:choose>
- <xsl:when test="number(current()) >= max($y2Data/number(text()))">
- <xsl:attribute name="maxY" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
-
- <xsl:value-of select="."/>
- </yData.postition>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$yData.attr">
-
- <xsl:for-each select="$yData.attr">
- <yData.postition pos="{position()}" >
- <xsl:attribute name="leadingTimeDate.int" select="replace(.,'-','')"/>
- <xsl:attribute name="system_cache__dita:year-timestamp-day" select="system_cache__dita:year-timestamp-day(.)"/>
- <xsl:attribute name="system_cache__dita:year-quarter" select="system_cache__dita:year-quarter(.)"/>
- <xsl:if test="$yData.attr.title[ position()=current()/position()]">
- <xsl:attribute name="yData.attr.title" select="$yData.attr.title[position()=current()/position()]/text()"/>
- <xsl:attribute name="yData.attr.title_ALL">
- <xsl:copy-of select="$yData.attr.title"></xsl:copy-of>
- </xsl:attribute>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="min($yData.attr/number(replace(.,'-',''))) = number(replace(.,'-',''))">
- <xsl:attribute name="min" select="number(replace(.,'-',''))"/>
- <xsl:choose>
- <xsl:when test="number(replace(.,'-','')) <= min($y2Data.attr/number(replace(.,'-','')))">
- <xsl:attribute name="minY" select="number(replace(.,'-',''))"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="max($yData.attr/number(replace(.,'-',''))) = number(replace(.,'-',''))">
- <xsl:attribute name="max" select="number(replace(.,'-',''))"/>
- <xsl:choose>
- <xsl:when test="number(replace(.,'-','')) >= max($y2Data.attr/number(replace(.,'-','')))">
- <xsl:attribute name="maxY" select="number(replace(.,'-',''))"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
-
- <xsl:value-of select="replace(.,'-','')"/>
- </yData.postition>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="$y2Data">
- <xsl:for-each select="$y2Data">
- <y2Data.postition pos="{position()}">
- <xsl:choose>
- <xsl:when test="min($y2Data/number(text())) = number(.)">
- <xsl:attribute name="min" select="number(.)"/>
- <xsl:choose>
- <xsl:when test="number(current()) <=min($yData/number(text()))">
- <xsl:attribute name="minY" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="max($y2Data/number(text())) = number(.)">
- <xsl:attribute name="max" select="number(.)"/>
- <xsl:choose>
- <xsl:when test="number(current()) >=max($yData/number(text()))">
- <xsl:attribute name="maxY" select="number(.)"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:value-of select="."/>
- </y2Data.postition>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$y2Data.attr">
- <xsl:for-each select="$y2Data.attr">
- <y2Data.postition pos="{position()}" deb_max="{number(replace(.,'-',''))}" deb_max2="{max($yData.attr/number(replace(.,'-','')))}">
-
- <xsl:attribute name="leadingTimeDate.int" select="replace(.,'-','')"/>
- <xsl:attribute name="system_cache__dita:year-timestamp-day" select="system_cache__dita:year-timestamp-day(.)"/>
- <xsl:if test="$y2Data.attr.title[ position()=current()/position()]">
- <xsl:attribute name="y2Data.attr.title" select="$y2Data.attr.title[ position()=current()/position()]"/>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="min($y2Data.attr/number(replace(.,'-',''))) = number(replace(.,'-',''))">
- <xsl:attribute name="min" select="number(replace(.,'-',''))"/>
- <xsl:choose>
- <xsl:when test="number(.) <=min($yData.attr/number(.))">
- <xsl:attribute name="minY" select="number(replace(.,'-',''))"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="max($y2Data.attr/number(replace(.,'-',''))) = number(replace(.,'-',''))">
- <xsl:attribute name="max" select="number(replace(.,'-',''))"/>
- <xsl:choose>
- <xsl:when test="number(replace(.,'-','')) >= max($yData.attr/number(replace(.,'-','')))">
- <xsl:attribute name="maxY" select="number(replace(.,'-',''))"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- <xsl:value-of select="replace(.,'-','')"/>
- </y2Data.postition>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </Data.analyzed>
- </xsl:variable>
-
- <xsl:copy-of select="$Data.analyzed"></xsl:copy-of>
- <!--<xsl:comment>199
- $xData.postition = <xsl:value-of select="$xData.postition"/>
-
- <xsl:for-each select="$Data.analyzed/descendant-or-self::*">
- name()=<xsl:value-of select="name()"/>
- <xsl:for-each select="@*">
- @<xsl:value-of select="name()"/>=<xsl:value-of select="."/><xsl:text> , </xsl:text>
- </xsl:for-each>
- </xsl:for-each>
-
- </xsl:comment>-->
-
- <xsl:variable name="_verticalSpan">
- <xsl:choose>
- <xsl:when test="$verticalSpan < $MIN_VERTICAL_SPAN">
- <xsl:value-of select="$MIN_VERTICAL_SPAN" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$verticalSpan" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <svg:svg version="1.1" width="{$width}" height="{$height}" preserveAspectRatio="xMinYMin" viewBox="0 0 {$viewBoxWidth} {$viewBoxHeight}"
- xmlns:svg="http://www.w3.org/2000/svg">
-
- <!--<xsl:variable name="test.max">
- <xsl:choose>
- <xsl:when test="max($Data.analyzed//yData.postition/number()) > 0 and
- max($Data.analyzed//yData.postition/number()) > 0
- ">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>-->
-
-
- <!--<xsl:variable name="y2DataMin">
- <xsl:call-template name="minimum">
- <xsl:with-param name="numbers" select="$y2Data" />
- </xsl:call-template>
- </xsl:variable>-->
-
-
-
-
-
- <xsl:choose>
- <xsl:when test="1=1"><!--$yData $xData.postition --><!-- max($Data.analyzed//yData.postition/number(@pos)) > 0 and
- max($Data.analyzed//y2Data.postition/number(@pos)) > 0
- -->
- <xsl:variable name="yDataMin" >
- <xsl:for-each select="$Data.analyzed//yData.postition/@min">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
-
- </xsl:variable>
-
- <xsl:variable name="yAllDataMin" >
- <xsl:for-each select="$Data.analyzed//@minY">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
-
- </xsl:variable>
-
- <xsl:variable name="y2DataMin" >
- <xsl:for-each select="$Data.analyzed//y2Data.postition/@min">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
-
- </xsl:variable>
-
- <xsl:variable name="yDataMax" >
- <xsl:for-each select="$Data.analyzed//yData.postition/@max">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:variable name="yAllDataMax" >
- <xsl:for-each select="$Data.analyzed//@maxY">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:variable name="y2DataMax" >
- <xsl:for-each select="$Data.analyzed//y2Data.postition/@max">
- <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
- </xsl:for-each>
-
- </xsl:variable>
-
- <xsl:variable name="yScale" select="$_verticalSpan div ($yDataMax - $yDataMin)" />
- <xsl:variable name="y2Scale" select="$_verticalSpan div ($y2DataMax - $y2DataMin)" />
- <xsl:variable name="yAllScale" select="$_verticalSpan div ($yAllDataMax - $yAllDataMin)" />
- <xsl:variable name="yDelta" select="round(($yDataMax - $yDataMin) div $yCount)*2" />
- <xsl:variable name="y2Delta" select="round(($y2DataMax - $y2DataMin) div $y2Count)*2" />
- <xsl:variable name="yAllDelta" select="round(($yAllDataMax - $yAllDataMin) div $yAllCount)*2" />
- <xsl:variable name="xMin" select="$leftPadding" />
- <xsl:variable name="xMax" select="$xMin+count($yData)*$barWidth+$rightPadding" />
- <xsl:variable name="yMin">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="$yDataMin - $yDelta" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="y2Min">
- <xsl:choose>
- <xsl:when test="$y2DataMin < 0">
- <xsl:value-of select="$y2DataMin - $y2Delta" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="yAllMin">
- <xsl:choose>
- <xsl:when test="$yAllDataMin < 0">
- <xsl:value-of select="$yAllDataMin - $yAllDelta" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="yMax" select="$yDataMax+$yDelta" />
- <xsl:variable name="y2Max" select="$y2DataMax+$y2Delta" />
- <xsl:variable name="yAllMax" select="$yAllDataMax+$yAllDelta" />
- <xsl:variable name="bottom">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="- $_verticalSpan" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="bottom2">
- <xsl:choose>
- <xsl:when test="$y2DataMin < 0">
- <xsl:value-of select="- $_verticalSpan" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="bottomAll">
- <xsl:choose>
- <xsl:when test="$yAllDataMin < 0">
- <xsl:value-of select="- $_verticalSpan" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yStep" select="$yDelta*$yScale" />
- <xsl:variable name="y2Step" select="$y2Delta*$y2Scale" />
- <xsl:variable name="yAllStep" select="$yAllDelta*$yAllScale" />
- <xsl:variable name="totalHeight" select="floor($_verticalSpan+$bottom+2*$yStep)" />
- <xsl:variable name="totalHeight2" select="floor($_verticalSpan+$bottom2+2*$y2Step)" />
- <xsl:variable name="totalHeightAll" select="floor($_verticalSpan+$bottomAll+2*$yAllStep)" />
-
- <xsl:variable name="yStart">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="$bottom - $yStep" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$bottom" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="y2Start">
- <xsl:choose>
- <xsl:when test="$y2DataMin < 0">
- <xsl:value-of select="$bottom2 - $y2Step" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$bottom2" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yAllStart">
- <xsl:choose>
- <xsl:when test="$yAllDataMin < 0">
- <xsl:value-of select="$bottomAll - $yAllStep" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$bottomAll" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yCentre">
- <xsl:choose>
- <xsl:when test="$yMin < 0">
- <xsl:value-of select="floor($yScale*($yMax + $yDelta div 2))" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="floor($yScale*$yMax)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="y2Centre">
- <xsl:choose>
- <xsl:when test="$y2Min < 0">
- <xsl:value-of select="floor($y2Scale*($y2Max + $y2Delta div 2))" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="floor($y2Scale*$y2Max)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yAllCentre">
- <xsl:choose>
- <xsl:when test="$yAllMin < 0">
- <xsl:value-of select="floor($yAllScale*($yAllMax + $yAllDelta div 2))" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="floor($yAllScale*$yAllMax)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Print centre -->
- <svg:circle cx="{$xMin}" cy="{$totalHeightAll}" r="1" /><!-- $yCentre $yAllCentre -->
- <xsl:variable name="labelDelta" select="number($FONT_SIZE) div 2" />
- <!-- Print y-axis -->
- <xsl:comment>130 printYAxis
- yDataMin = <xsl:value-of select="$yDataMin"/> - <xsl:value-of select="$yDataMin"/>
-
- yDataMax = <xsl:value-of select="$yDataMax"/>
- y2DataMax = <xsl:value-of select="$y2DataMax"/>
- $xMin = <xsl:value-of select="$xMin"/>
- $yDataMax = <xsl:value-of select="$yDataMax"/>
- $y2DataMax = <xsl:value-of select="$y2DataMax"/>
- $yAllDataMax = <xsl:value-of select="$yAllDataMax"/>
-
- $_verticalSpan = <xsl:value-of select="$_verticalSpan"/>
- $topPadding = <xsl:value-of select="$topPadding"/>
- yDelta = <xsl:value-of select="$yDelta"/>
- y2Delta = <xsl:value-of select="$y2Delta"/>
- yAllDelta = <xsl:value-of select="$yAllDelta"/> = roundO($yAllDataMax - $yAllDataMin) div $yAllCount)*2
-
- $yDataMin = <xsl:value-of select="$yDataMin"/>
- $y2DataMin = <xsl:value-of select="$y2DataMin"/>
- $yAllDataMin = <xsl:value-of select="$yAllDataMin"/>
-
- $xData.name = <xsl:value-of select="$xData.name"/>
- $yScale = <xsl:value-of select="$yScale"/>
- $y2Scale = <xsl:value-of select="$y2Scale"/>
- $yAllScale = <xsl:value-of select="$yAllScale"/> = $_verticalSpan=<xsl:value-of select="$_verticalSpan"/> div ( $yAllDataMax=<xsl:value-of select="$yAllDataMax"/> - $yAllDataMin=<xsl:value-of select="$yAllDataMin"/> )
-
- $labelDelta = <xsl:value-of select="$labelDelta"/>
- $yMin = <xsl:value-of select="$yMin"/>
- $y2Min = <xsl:value-of select="$y2Min"/>
- $yAllMin = <xsl:value-of select="$yAllMin"/>
-
- $xMax = <xsl:value-of select="$xMax"/>
-
- $yMax = <xsl:value-of select="$yMax"/>
- $y2Max = <xsl:value-of select="$y2Max"/>
- $yAllMax = <xsl:value-of select="$yAllMax"/>
-
- $leftPadding = <xsl:value-of select="$leftPadding"/>
-
- $bottom = <xsl:value-of select="$bottom"/>
- $bottom2 = <xsl:value-of select="$bottom2"/>
- $bottomAll = <xsl:value-of select="$bottomAll"/>
-
- $yStep = <xsl:value-of select="$yStep"/>
- $y2Step = <xsl:value-of select="$y2Step"/>
- $yAllStep = <xsl:value-of select="$yAllStep"/>
-
- $totalHeight = <xsl:value-of select="$totalHeight"/>
- $totalHeight2 = <xsl:value-of select="$totalHeight2"/>
- $totalHeightAll = <xsl:value-of select="$totalHeightAll"/>
-
- $yStart = <xsl:value-of select="$yStart"/>
- $y2Start = <xsl:value-of select="$y2Start"/>
- $yAllStart = <xsl:value-of select="$yAllStart"/>
-
- $yCentre = <xsl:value-of select="$yCentre"/>
- $y2Centre = <xsl:value-of select="$y2Centre"/>
- $yAllCentre = <xsl:value-of select="$yAllCentre"/>
-
- $yCount = <xsl:value-of select="$yCount"/>
- $y2Count = <xsl:value-of select="$y2Count"/>
- $yAllCount = <xsl:value-of select="$yAllCount"/>
-
- </xsl:comment>
-
-
-
- <!--<xsl:variable name="step" select="$yDelta"/>-->
- <!--<xsl:for-each select="$Data.analyzed//xData.name">
- <xsl:variable name="index" select="number(@pos)+$step"/>
- <xsl:variable name="y">
- <xsl:choose>
- <xsl:when test="$yMin < 0">
- <xsl:value-of select="floor($yScale*($yMax - $index + $step div 2))" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="floor($yScale*($yMax - $index))" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-\-<svg:text x="{($xMin - 5)}"
- y="{($y + number($labelDelta))}"
-
- text-anchor="end"
- fill="black"
- font-family="{$FONT}"
- font-weight="bold"
- font-size="{$FONT_SIZE}"
- xmlns:svg="http://www.w3.org/2000/svg">
- <xsl:value-of select="text()" /><!-\\- testf="{floor($yScale*($yMax - $index))}"
- testf2="{($yMax - $index)}"
- testf3="{$yMax}"
- index="{$index}" -\\->
- </svg:text>-\->
-
-
- </xsl:for-each>-->
- <xsl:call-template name="p5gnuplot:printYAxis">
- <xsl:with-param name="totalHeightAll" select="$totalHeightAll"/>
- <xsl:with-param name="yDelta" select="$yDelta"/>
- <xsl:with-param name="y2Delta" select="$y2Delta"/>
- <xsl:with-param name="yAllDelta" select="$yAllDelta"/>
- <xsl:with-param name="index" select="$yMin" />
- <xsl:with-param name="index2" select="$y2Min" />
- <xsl:with-param name="step" select="$yDelta" />
- <xsl:with-param name="step2" select="$y2Delta" />
- <xsl:with-param name="stepAll" select="$yAllDelta" />
-
- <xsl:with-param name="viewBoxHeight" select="$viewBoxHeight"/>
-
- <xsl:with-param name="xMin" select="$xMin" />
- <xsl:with-param name="xMax" select="$xMax" />
- <xsl:with-param name="yMin" select="$yMin" />
- <xsl:with-param name="y2Min" select="$y2Min" />
- <xsl:with-param name="yAllMin" select="$yAllMin" />
- <xsl:with-param name="yAllDataMin" select="$yAllDataMin"/>
- <xsl:with-param name="yMax" select="$yMax" />
- <xsl:with-param name="y2Max" select="$y2Max" />
- <xsl:with-param name="yAllMax" select="$yAllMax" />
- <xsl:with-param name="yAllDataMax" select="$yAllDataMax"/>
- <xsl:with-param name="yScale" select="$yScale" />
- <xsl:with-param name="y2Scale" select="$y2Scale" />
- <xsl:with-param name="yAllScale" select="$yAllScale" />
-
- <xsl:with-param name="Data.analyzed" select="$Data.analyzed" tunnel="yes"/>
- </xsl:call-template>
-
-
- <xsl:comment>#253 after text</xsl:comment>
-
-
- <svg:g transform="translate(0 {$totalHeight}) scale(1 -1)">
- <svg:line x1="{$xMin}" y1="{$yStart}" x2="{$xMin}" y2="{$totalHeight}"
- deb="569_os_pion_1"
- stroke="black" stroke-width="2" />
- </svg:g>
-
- <!--<xsl:call-template name="printYAxis">
- <xsl:with-param name="index" select="$yMin" />
- <xsl:with-param name="step" select="$yDelta" />
- <xsl:with-param name="xMin" select="$xMin" />
- <xsl:with-param name="xMax" select="$xMax" />
- <xsl:with-param name="yMin" select="$yMin" />
- <xsl:with-param name="yMax" select="$yMax" />
- <xsl:with-param name="yScale" select="$yScale" />
- </xsl:call-template>-->
- <!--<svg:g transform="translate(0 {$totalHeight}) scale(1 -1)">
- <svg:line x1="{$xMin}" y1="{$yStart}" x2="{$xMin}" y2="{$totalHeight}"
- stroke="black" stroke-width="2" />
- </svg:g>-->
- <xsl:comment>#301 after text</xsl:comment>
- <!-- Print bars -->
- <svg:g transform="translate(0 {$totalHeightAll}) scale(1 -1)"><!-- $yCentre -->
- <xsl:for-each select="$Data.analyzed//xData.name">
- <xsl:variable name="colour">
- <xsl:call-template name="colour">
- <xsl:with-param name="index" select="number(@pos)" /><!-- position() -->
- </xsl:call-template>
- </xsl:variable>
- <!--<xsl:variable name="height" select="$Data.analyzed//yData.postition[@pos=current()/@pos]/number()*$yScale" />-->
-
- <!-- x0 , y250
- x50, y0
- -->
-
- <xsl:variable name="index.context.value.y" select="$Data.analyzed//yData.postition[@pos=current()/@pos]/number()"/>
- <xsl:variable name="index.context.value.y2" select="$Data.analyzed//y2Data.postition[@pos=current()/@pos]/number()"/>
- <xsl:variable name="y" select="$viewBoxHeight - (( $viewBoxHeight div $yAllDataMax ) * $index.context.value.y)"/><!-- $totalHeightAll - (( $totalHeightAll div ($yAllDataMax - $yAllDataMin) ) * $index.context.value.y) -->
-
- <xsl:variable name="y2" select="(( $totalHeightAll div ($yAllDataMax - $yAllDataMin) ) * ($index.context.value.y - $index.context.value.y2 ))"/>
-
- <!--<xsl:variable name="height2" select="$y2Scale * $index.context.value.y2" />--><!--$Data.analyzed//y2Data.postition[@pos=current()/@pos]/number()*$yAllScale $y2Scale -->
-
- <xsl:variable name="y">
- <xsl:call-template name="absolute">
- <xsl:with-param name="number" select="$y" /><!-- - number($topPadding) -->
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="y2.as.height" select="((( $totalHeightAll div $yAllDataMax ) * (($index.context.value.y - $index.context.value.y2) )) ) " />
- <xsl:variable name="y2.as.height">
- <xsl:call-template name="absolute">
- <xsl:with-param name="number" select="floor($y2.as.height) " /><!-- - number($topPadding) -->
- </xsl:call-template>
- </xsl:variable>
- <!--<xsl:variable name="absoluteHeight2">
- <xsl:call-template name="absolute">
- <xsl:with-param name="number" select="floor($height2)" />
- </xsl:call-template>
- </xsl:variable>-->
- <!--<xsl:variable name="y">
- <xsl:choose>
- <xsl:when test="$Data.analyzed//yData.postition[@pos=current()/@pos]/number()">
- <xsl:value-of select="$Data.analyzed//yData.postition[@pos=current()/@pos]/number()*$yAllScale"/><!-\- $yScale -\->
- </xsl:when>
- <!-\-<xsl:when test="$height >= 0">
- <xsl:value-of select="0" />
- </xsl:when>-\->
- <!-\-<xsl:otherwise>
- <xsl:value-of select="$height" />
- </xsl:otherwise>-\->
- <xsl:otherwise>
- <xsl:message terminate="yes">330 error</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>-->
-
- <svg:rect x="{$xMin+(position() - 1)*$barWidth}" y="{abs($y - $topPadding)}" rx="2" ry="2"
- width="{$barWidth}" height="{abs($y2.as.height - 5)}" deb="#620 grafy $y2Scale={$y2Scale} all {$yAllScale} pos{position()} valy={$index.context.value.y} valy2={$index.context.value.y2} y2.as.height={$y2.as.height} $totalHeight={$totalHeight} $yAllCentre={$yAllCentre} $yAllDataMax{$yAllDataMax} $topPadding={$topPadding}"
- fill="{$colour}" stroke="black" stroke-width="1" />
- </xsl:for-each>
- </svg:g>
-
- <xsl:comment>#334 after bars</xsl:comment>
-
- <!-- Print x-axis -->
- <svg:g transform="translate(0 {$totalHeightAll})"><!-- $yAllCentre $yCentre -->
- <!--<xsl:call-template name="p5gnuplot:printXAxis">
- <xsl:with-param name="xData" select="$Data.analyzed//xData.postition" /><!-\- $xData.postition -\->
- <xsl:with-param name="step" select="$barWidth" />
- <xsl:with-param name="xMin" select="$xMin+$barWidth div 2" />
- <xsl:with-param name="xMax" select="$yCount" />
- <xsl:with-param name="Data.analyzed" select="$Data.analyzed" tunnel="yes"/><!-\- $Data.analyzed -\->
- </xsl:call-template>-->
- <xsl:call-template name="p5gnuplot:printXAxis">
- <xsl:with-param name="xData" select="$Data.analyzed//xData.postition" /><!-- $xData.postition -->
- <xsl:with-param name="step" select="$barWidth" />
- <xsl:with-param name="xMin" select="$xMin+$barWidth div 2" />
- <xsl:with-param name="xMax" select="$yCount" />
- <xsl:with-param name="Data.analyzed" select="$Data.analyzed" tunnel="yes"/><!-- $Data.analyzed -->
- </xsl:call-template>
- <xsl:comment>#352 after </xsl:comment>
- <svg:line x1="{$xMin}" y1="0" x2="{$xMax}" y2="0" stroke="black" stroke-width="2" deb="#647"/>
- </svg:g>
-
- <xsl:comment>#355 test
- <xsl:for-each select="$Data.analyzed//xData.postition">
- pos=<xsl:value-of select="position()"/>
- </xsl:for-each>
- </xsl:comment>
-
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>#466 error max($Data.analyzed//yData.postition/number()) > 0 and
- max($Data.analyzed//y2Data.postition/number()) > 0
- </xsl:comment>
- </xsl:otherwise>
- </xsl:choose>
- </svg:svg>
- </xsl:template>
- <!-- Prints a simple bar chart with grid -->
- <!--<xsl:template name="barChart">
- <xsl:param name="xData" />
- <xsl:param name="yData" />
- <xsl:param name="width" select="'100%'" />
- <xsl:param name="height" select="'100%'" />
- <xsl:param name="viewBoxWidth" select="300" />
- <xsl:param name="viewBoxHeight" select="300" />
- <xsl:param name="barWidth" select="15" />
- <xsl:param name="leftPadding" select="20" />
- <xsl:param name="rightPadding" select="10" />
- <xsl:param name="verticalSpan" select="100" />
- <xsl:variable name="xCount" select="count($xData)" />
- <xsl:variable name="yCount" select="count($yData)" />
- <xsl:variable name="_verticalSpan">
- <xsl:choose>
- <xsl:when test="$verticalSpan < $MIN_VERTICAL_SPAN">
- <xsl:value-of select="$MIN_VERTICAL_SPAN" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$verticalSpan" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <svg:svg version="1.1" width="{$width}" height="{$height}" preserveAspectRatio="xMinYMin" viewBox="0 0 {$viewBoxWidth} {$viewBoxHeight}"
- xmlns:svg="http://www.w3.org/2000/svg">
- <xsl:if test="$xCount > 0 and $yCount > 0">
- <xsl:variable name="yDataMin">
- <xsl:call-template name="minimum">
- <xsl:with-param name="numbers" select="$yData" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="yDataMax">
- <xsl:call-template name="maximum">
- <xsl:with-param name="numbers" select="$yData" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="yScale" select="$_verticalSpan div ($yDataMax - $yDataMin)" />
- <xsl:variable name="yDelta" select="round(($yDataMax - $yDataMin) div $yCount)*2" />
- <xsl:variable name="xMin" select="$leftPadding" />
- <xsl:variable name="xMax" select="$xMin+count($yData)*$barWidth+$rightPadding" />
- <xsl:variable name="yMin">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="$yDataMin - $yDelta" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yMax" select="$yDataMax+$yDelta" />
- <xsl:variable name="bottom">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="- $_verticalSpan" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yStep" select="$yDelta*$yScale" />
- <xsl:variable name="totalHeight" select="floor($_verticalSpan+$bottom+2*$yStep)" />
- <xsl:variable name="yStart">
- <xsl:choose>
- <xsl:when test="$yDataMin < 0">
- <xsl:value-of select="$bottom - $yStep" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$bottom" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="yCentre">
- <xsl:choose>
- <xsl:when test="$yMin < 0">
- <xsl:value-of select="floor($yScale*($yMax + $yDelta div 2))" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="floor($yScale*$yMax)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-\- Print centre -\->
- <!-\-<svg:circle cx="{$xMin}" cy="{$yCentre}" r="1" />-\->
- <!-\- Print y-axis -\->
- <!-\-<xsl:call-template name="printYAxis">
- <xsl:with-param name="index" select="$yMin" />
- <xsl:with-param name="step" select="$yDelta" />
- <xsl:with-param name="xMin" select="$xMin" />
- <xsl:with-param name="xMax" select="$xMax" />
- <xsl:with-param name="yMin" select="$yMin" />
- <xsl:with-param name="yMax" select="$yMax" />
- <xsl:with-param name="yScale" select="$yScale" />
- </xsl:call-template>-\->
- <!-\-<svg:g transform="translate(0 {$totalHeight}) scale(1 -1)">
- <svg:line x1="{$xMin}" y1="{$yStart}" x2="{$xMin}" y2="{$totalHeight}"
- stroke="black" stroke-width="2" />
- </svg:g>-\->
- <!-\- Print bars -\->
- <!-\-<svg:g transform="translate(0 {$yCentre}) scale(1 -1)">
- <xsl:for-each select="$yData">
- <xsl:variable name="colour">
- <xsl:call-template name="colour">
- <xsl:with-param name="index" select="position()" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="height" select=".*$yScale" />
- <xsl:variable name="absoluteHeight">
- <xsl:call-template name="absolute">
- <xsl:with-param name="number" select="floor($height)" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="y">
- <xsl:choose>
- <xsl:when test="$height >= 0">
- <xsl:value-of select="0" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$height" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <svg:rect x="{$xMin+(position() - 1)*$barWidth}" y="{$y}" rx="2" ry="2"
- width="{$barWidth}" height="{$absoluteHeight}"
- fill="{$colour}" stroke="black" stroke-width="1" />
- </xsl:for-each>
- </svg:g>-\->
- <!-\- Print x-axis -\->
- <!-\-<svg:g transform="translate(0 {$yCentre})">
- <xsl:call-template name="printXAxis">
- <xsl:with-param name="xData" select="$xData" />
- <xsl:with-param name="step" select="$barWidth" />
- <xsl:with-param name="xMin" select="$xMin+$barWidth div 2" />
- <xsl:with-param name="xMax" select="$yCount" />
- </xsl:call-template>
- <svg:line x1="{$xMin}" y1="0" x2="{$xMax}" y2="0" stroke="black" stroke-width="2" />
- </svg:g>-\->
- </xsl:if>
- </svg:svg>
- </xsl:template>-->
- </xsl:stylesheet>
|