Three templates are available to help with the preparation of the chart data:
Prepares chart data from the totals of the specified column names
Prepares chart data from the specified column names
Prepares chart data from a list of values
Note: Chart data must be stored in an xsl:variable so it can be passed to the svg-chart:draw template.
Note: A list of names or values must be separated with spaces, not commas.
Example 1
In this example, chart data is prepared for the search results columns ColA, ColB, ColC, column labels for these columns from the search definition are used to identify the values which are the totals for each column. One data series is produced with the name 'totals'.
<xsl:variable name="totals-data"> <xsl:call-template name="svg-chart:data-totals"> <xsl:with-param name="columns" select="'ColA ColB ColC'"/> </xsl:call-template> </xsl:variable>
Example 2
In this example, chart data is prepared for the search results columns ColB, ColC, ColD. The values in ColA are used to identify the values. Three data series are produced, each with the name of the column label from the search definition:
<xsl:variable name="column-data"> <xsl:call-template name="svg-chart:data-columns"> <xsl:with-param name="labels" select="'ColA'"/> <xsl:with-param name="columns" select="'ColB ColC ColD'"/> </xsl:call-template> </xsl:variable>
Example 3
In this example, chart data is specified directly as a list of values. The specified labels and values are used. Two data series are produced with the names 'Series 1' and 'Series 2':
<xsl:variable name="list-data"> <xsl:call-template name="svg-chart:data-add-series"> <xsl:with-param name="name" select="'Series 1'"/> <xsl:with-param name="labels" select="'A B C'"/> <xsl:with-param name="values" select="'1 2 3'"/> </xsl:call-template> <xsl:call-template name="svg-chart:data-add-series"> <xsl:with-param name="name" select="'Series 2'"/> <xsl:with-param name="labels" select="'X Y Z'"/> <xsl:with-param name="values" select="'7 8 9'"/> </xsl:call-template> </xsl:variable>
The resulting chart data will be structured like this (although this is transparent):
<series name="Series 1"> <point label="A" value="1"> <point label="B" value="2"> <point label="C" value="3"> </series> <series name="Series 2"> <point label="X" value="7"> <point label="Y" value="8"> <point label="Z" value="9"> </series>
Copyright © 2014 CA.
All rights reserved.
|
|