I have a large shapefile and I'm trying to automate a process to generate histograms of several fields with the MakeGraph tool, but I'm receiving the following error.
class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid. ERROR 001020: Input series error. Incompatible parameter list. Click 'Always reset parameters...' check-box to reset parameters. Failed to execute (MakeGraph).
Any idea why this is happening? My inputs are as follows...
input table
= shapefile,fieldList
is generated by input,workspace
= output folder,input_template
= a .grf or .tee (tried both),run
is just a boolean true or false
Here's my code:
# Import arcpy module
import arcpy
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
input_table = arcpy.GetParameterAsText(0)
fieldList = arcpy.GetParameterAsText(1)
workspace = arcpy.GetParameterAsText(2)
arcpy.env.workspace = workspace
input_template = arcpy.GetParameterAsText(3)
run = arcpy.GetParameterAsText(4)
countBin = 10
# Boolean selection
if run == 'true':
# Iterate over selected field names
for fieldName in fieldList.split(';'):
out_graph_name = "histogram"
out_graph_jpg = fieldName + "_histogram.jpg"
# Create the graph
graph = arcpy.Graph()
# Add a histogram series to the graph
graph.addSeriesHistogram(input_table, fieldName, countBin)
# Specify the title of the left axis
graph.graphAxis[0].title = "Count"
# Specify the title of the bottom axis
graph.graphAxis[2].title = fieldName
# Specify the title of the Graph
graph.graphPropsGeneral.title = fieldName + " Histogram"
# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, out_graph_name)
# Save the graph as an image
arcpy.SaveGraph_management(out_graph_name, out_graph_jpg, "MAINTAIN_ASPECT_RATIO", 600, 375)
else:
print "done"