Altova StyleVision 2024 Enterprise Edition

The chart functions listed below enable you to create, generate, and save charts as images. They are supported in the current version of your Altova product in the manner described below. However, note that in future versions of your product, support for one or more of these functions might be discontinued or the behavior of individual functions might change. Consult the documentation of future releases for information about support for Altova extension functions in that release.

 

Note:Chart functions are supported only in Altova's Server products and the Enterprise Editions of Altova products.

 

Note:Supported image formats for charts in server editions are jpg, png, and bmp. The best option is png because it is lossless and compressed. In Enterprise editions, the supported formats are jpg. png, bmp, and gif.

 

Functions for generating and saving charts

These functions take the chart object (obtained with the chart creation functions) and either generate an image or save an image to file

 

altova:generate-chart-image (\$chart, \$width, \$height, \$encoding) as atomic

 

where

 

\$chart is the chart extension item obtained with the altova:create-chart function

\$width and \$height must be specified with a length unit

\$encoding may be x-binarytobase64 or x-binarytobase16

 

The function returns the chart image in the specified encoding.

 

altova:generate-chart-image (\$chart, \$width, \$height, \$encoding, \$imagetype) as atomic

 

where

 

\$chart is the chart extension item obtained with the altova:create-chart function

\$width and \$height must be specified with a length unit

\$encoding may be x-binarytobase64 or x-binarytobase16

\$imagetype may be one of the following image formats: png, gif, bmp, jpg, jpeg. Note that gif is not supported on server products. Also see note at top of page.

 

The function returns the chart image in the specified encoding and image format.

 

altova:save-chart-image (\$chart, \$filename, \$width, \$height) as empty() (Windows only)

 

where

 

\$chart is the chart extension item obtained with the altova:create-chart function

\$filename is the path to and name of the file to which the chart image is to be saved

\$width and \$height must be specified with a length unit

 

The function saves the chart image to the file specified in \$filename. Alternatively to this function, you could also use the xsl:result-document function with encoding="x-base64tobinary", where the image-data content is obtained via either the generate-chart-image() function or chart() function.

 

altova:save-chart-image (\$chart, \$filename, \$width, \$height, \$imagetype) as empty() (Windows only)

 

where

 

\$chart is the chart extension item obtained with the altova:create-chart function

\$filename is the path to and name of the file to which the chart image is to be saved

\$width and \$height must be specified with a length unit

\$imagetype may be one of the following image formats: png, gif, bmp, jpg, jpeg. Note that gif is not supported on server products. Also see note at top of page.

 

The function saves the chart image to the file specified in \$filename in the image format specified. Alternatively to this function, you could also use the xsl:result-document function with encoding="x-base64tobinary", where the image-data content is obtained via either the generate-chart-image() function or chart() function.

 

 

Functions for creating charts

The following functions are used to create charts.

 

altova:create-chart(\$chart-config, \$chart-data-series*) as chart extension item

 

where

 

\$chart-config is the chart-config extension item obtained with the altova:create-chart-config function or via the altova:create-chart-config-from-xml function

\$chart-data-series is the chart-data-series extension item obtained with the altova:create-chart-data-series function or altova:create-chart-data-series-from-rows function

 

The function returns a chart extension item, which is created from the data supplied via the arguments.

 

altova:chart(\$chart-config, \$chart-data-series*) as chart extension item

 

where

 

\$chart-config is the chart-config extension item. It is an unordered series of four key: value pairs, where the four keys are "width", "height", "title", and "kind". The values of width and height are integers and specify the width and height of the chart in pixels. The value of kind is one of: Pie, Pie3d, BarChart, BarChart3d, BarChart3dGrouped, LineChart, ValueLineChart, RoundGauge, BarGauge.

\$chart-data-series is each an array of size 3, where each array defines a chart-data-series. Each array is composed of: (i) the name of the data series, (ii) the X-Axis values, (iii) the Y-Axis values. Multiple data series may be submitted; in the example below, for example, the two arrays respectively give data for monthly minimum and maximum temperatures.

 

The function returns an xs:base64Binary type item that contains the chart image. This image is created from the data supplied via the arguments of the function. Note that, since this function uses arrays and maps, it can be used only in XPath 3.1, XQuery 3.1, or XSLT 3.0.

 

Example: altova:chart( map{'width':800'height':600"kind":"LineChart""title":"Monthly Temperatures"}, (['Min'\$temps/Month, \$temps/Month/@min], ['Max'\$temps/Month, \$temps/Month/@max]) )

 

altova:create-chart-config(\$type-name, \$title) as chart-config extension item

 

where

 

\$type-name specifies the type of chart to be created: Pie, Pie3d, BarChart, BarChart3d, BarChart3dGrouped, LineChart, ValueLineChart, RoundGauge, BarGauge

\$title is the name of the chart

 

The function returns a chart-config extension item containing the configuration information of the chart.

 

altova:create-chart-config-from-xml(\$xml-struct) as chart-config extension item

 

where

 

\$xml-struct is the XML structure containing the configuration information of the chart

 

The function returns a chart-config extension item containing the configuration information of the chart. This information is supplied in an XML data fragment.

 

altova:create-chart-data-series(\$series-name?, \$x-values*, \$y-values*) as chart-data-series extension item

 

where

 

\$series-name specifies the name of the series

\$x-values gives the list of X-Axis values

\$y-values gives the list of Y-Axis values  

 

The function returns a chart-data-series extension item containing the data for building the chart: that is, the names of the series and the Axes data.

 

altova:create-chart-data-row(x, y1, y2, y3, ...) as chart-data-x-Ny-row extension item

 

where

 

x is the value of the X-Axis column of the chart data row

yN are the values of the Y-Axis columns  

 

The function returns a chart-data-x-Ny-row extension item, which contains the data for the X-Axis column and Y-Axis columns of a single series.

 

altova:create-chart-data-series-from-rows(\$series-names as xs:string*, \$row*) as chart-data-series extension item

 

where

 

\$series-name is the name of the series to be created

\$row is the chart-data-x-Ny-row extension item that is to be created as a series  

 

The function returns a chart-data-series extension item, which contains the data for the X-Axis and Y-Axes of the series.

 

altova:create-chart-layer(\$chart-config, \$chart-data-series*) as chart-layer extension item

 

where

 

\$chart-config is the chart-config extension item obtained with the altova:create-chart-config function or via the altova:create-chart-config-from-xml function

\$chart-data-series is the chart-data-series extension item obtained with the altova:create-chart-data-series function or altova:create-chart-data-series-from-rows function  

 

The function returns a chart-layer extension item, which contains chart-layer data.

 

altova:create-multi-layer-chart(\$chart-config, \$chart-data-series*, \$chart-layer*)

 

where

 

\$chart-config is the chart-config extension item obtained with the altova:create-chart-config function or or via the altova:create-chart-config-from-xml function

\$chart-data-series is the chart-data-series extension item obtained with the altova:create-chart-data-series function or altova:create-chart-data-series-from-rows function  

\$chart-layer is the chart-layer extension item obtained with the altova:create-chart-layer function

 

The function returns a multi-layer-chart item.

 

altova:create-multi-layer-chart(\$chart-config, \$chart-data-series*, \$chart-layer*, xs:boolean \$mergecategoryvalues)

 

where

 

\$chart-config is the chart-config extension item obtained with the altova:create-chart-config function or or via the altova:create-chart-config-from-xml function

\$chart-data-series is the chart-data-series extension item obtained with the altova:create-chart-data-series function or altova:create-chart-data-series-from-rows function  

\$chart-layer is the chart-layer extension item obtained with the altova:create-chart-layer function  

\$mergecategoryvalues merges the values of multiple data series if true, does not merge if false

 

The function returns a multi-layer-chart item.

 

© 2017-2023 Altova GmbH