Desktop User Guides > Reporter > Publishing the results > Exporting charts using IBM SPSS Visualization custom chart types > Creating a custom chart template
 
Creating a custom chart template
When creating an HTML Export custom chart template, you must consider the following:
The graph structure.
How many dimensions there are for each graph.
Whether any coordinate system transformations are required.
Which graphic elements and statistics are appropriate.
Any aesthetics (such as color) that split graphic elements. When using aesthetics, a legend that provides a key to the aesthetics is typically required.
The samples in the template located at C:\Program Files\Common\ Files\IBM\SPSS\DataCollection\7\TOM\Templates\Visualization can be used when creating a new template.
1 Copy the existing template section, and then change the template name:
<?xml version="1.0" encoding="UTF-8"?>
<visualization id="visualization1" style="visualizationStyle" version="2.8">
<extension>
<defines the following template, copies the following section to the new template, and modifies the template name -->
<template aggregates="true" inst="http://www.w3.org/2001/XMLSchema-instance" location="http://xml.spss.com/visualization
http://xml.spss.com/visualization/vizml-2.8.xsd" url="http://xml.spss.com/visualization" version="1">
<!-- define the template name -->
<name xml:lang="en">Template Name</name>
<description xml:lang="en"/>
<!-- define the variables that are used in the template -->
<!-- Typically, X, Y, Color, Label...-->
<variable type="categorical">
<name xml:lang="en">X</name>
</variable>
<variable type="categorical">
<name xml:lang="en">Color</name>
<description xml:lang="en"/>
</variable>
<variable type="continuous">
<name xml:lang="en">Y</name>
</variable>
<variable type="categorical">
<name xml:lang="en">Label</name>
<description xml:lang="en"/>
</variable>
</template>
</extension>
<!-- Structure -->
<!-- defines the details for the following chart (such as the chart location, coordinate, type, dimensions...) -->
<graph cellStyle="graphStyle" id="graph">

</graph>
</visualization>
2 Add the dimension elements for the coordinates in the graph element section. Depending on the desired chart, add the appropriate dimensions and dimension sub-elements.
When a third dimension is required, no sub-element or attribute can be defined for the dimension and the obliqueTransform element needs set as the sub-element of the coordinate element in order to create the pseudo-dimension.
<?xml version="1.0" encoding="UTF-8"?>
<visualization id="visualization1" style="visualizationStyle" version="2.8">
<extension>
<template ...>
......
</template>
</extension>
<!-- Structure -->
<!-- graph section that defines the details for the following chart (such as the chart location, coordinate, type,
dimensions...) -->
<graph id="graph">
<coordinates id="coordinates_245803">
<dimension id="dimension_245804">
<axis id="axis_245805">
<label id="label_245806" purpose="auto" style="labelStyle">
<descriptionGroup id="descriptionGroup_245807" target="X">
<description id="description_245808" name="label"/>
</descriptionGroup>
</label>
</axis>
</dimension>
......
<!-- If a third dimension is required, the following two lines that define -->
<!-- the third dimension (pseudo-dimension)are required -->
<obliqueTransform foreShortening="0.1" id="obliqueTransform_259639"/>
<dimension id="dimension_259640"/>
</graph>
</visualization>
3 Add the chart type-related elements (such as polygon element, interval element, point element and so on), and the associated sub-elements:
<?xml version="1.0" encoding="UTF-8"?>
<visualization id="visualization1" style="visualizationStyle" version="2.8">
<extension>
<template ...>
......
</template>
</extension>
<!-- Structure -->
<!-- graph section that defines the details for the following chart (such as the chart location, coordinate, type,
dimensions...) -->
<graph id="graph">
<coordinates id="coordinates_245803">
<dimension id="dimension_245804">
......
</dimension>
......
</coordinates>
<!-- defines the chart types (such as polygon, interval, point..._ -->
<!-- also defines the relationship between the variables and the nViZn charting engine -->
<polygon id="polygon_245816" style="polygonStyle">
<binStatistic gridType="square" id="binStatistic_245817" method="aggregate"/>
<colorComponent id="colorAesthetic" type="saturation" variable="Y">
<summaryStatistic id="summaryStatistic_245819" method="mean"/>
</colorComponent>
<labeling id="labeling_245820" textFrameStyle="labelingStyle" variable="Label">
<summaryStatistic id="summaryStatistic_245821" method="mode"/>
</labeling>
<!-- defines the relationship between template variables and the charting engine for x, y element… -->
<x variable="X"/>
<y variable="Color"/>
</polygon>
</graph>
</visualization>
4 Add other required elements or attributes. Typically, the dimension and chart type settings are not enough; container, location, labframe and other elements are also required.
5 Save the custom template and specify a file extension of .viztemplate. For example, a custom template named test would appear as test.viztemplate.
Checking the custom template
1 Open UNICOM Intelligence Reporter, add some variables to a table, and then populate the table.
2 Export the table results (File > Export > Tables). Click More >> in the Export Tables dialog, select Table and Chart from the Include list, select IBM SPSS Visualization from the Chart engine list, and then click Browse.
3 Select the custom chart template file and set the other export properties.
4 Click OK.
5 Verify the resulting charts display as expected.
See also
Exporting charts using IBM SPSS Visualization custom chart types