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

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)

    print "done"
  • you mention the fieldlist is generated by input - can you verify that the fieldname is in the input table during the loop? Nov 3, 2014 at 0:50
  • fieldList is a field parameter with multivalues obtained from the shapefile and fieldName is each of the field names that are selected Nov 3, 2014 at 2:02

1 Answer 1


Your issue is here I believe:

graph.addSeriesHistogram(input_table, fieldName, countBin)

Specifically, with the variable fieldName. For addSeriesHistogram, fieldNameneeds to be a layer object. Instead, it is a string in your code. To access the layer object, you'll need to use arcpy.ListLayers.

Try this code:

#Create map object
mxd = arcpy.mapping.MapDocument("CURRENT") 

#iterate through layer objects in map object
for lyr in arcpy.mapping.ListLayers(mxd):

    #Find layer with name 'fieldName'
    if lyr.name == fieldName: 
        graph.addSeriesHistogram(input_table, lyr, countBin)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.