GraphTemplate (arcpy)

Summary

Graph templates allow you to create graphs from different datasets that have the same basic structure. The template file contains all the information necessary to create those graphs, except the actual data. Once the template is loaded, you can specify the particular data source you want to use.

Discussion

Template files are maintained in a folder called GraphTemplates, which can be in two places in an ArcGIS installation. One location for the GraphTemplates folder is where your ArcGIS is installed, typically C:\Program Files\ArcGIS\Desktop10.1\GraphTemplates.

The other is in the Windows Documents and Settings folder, under Application Data for Esri software. The path would be similar to the following: C:\Documents and Settings\UserName\Application Data\ESRI\ArcMap\GraphTemplates.

Syntax

GraphTemplate (templateName)
ParameterExplanationData Type
templateName

The graph template (.tee) used to construct the graph template. By default, uses default.tee.

String

Code Sample

GraphTemplate example

Create a graph using a graph template.

import arcpy

input_data = 'c:/data/portland.gdb/downtown'
out_graph = 'portland_graph'
out_grf = 'c:/output/downtown_graph.grf'

graph = arcpy.Graph()
graph.addSeriesBarVertical(input_data, 'Value')

arcpy.MakeGraph_management(arcpy.GraphTemplate(), graph, out_graph)
arcpy.SaveGraph_management(out_graph, out_grf)

Related Topics

2/5/2014