import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\temp\data.gdb" table = "Meters" fields = ["METER_NUMBER"] list = [] rows = arcpy.SearchCursor(table) for row in rows: list.append(row.METER_NUMBER) del row, rows #remove duplicates from list list = dict.fromkeys(list) list = list.keys() for n in list: arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + str(n)) #get TWACs_Number value for row in arcpy.SearchCursor(r"in_memory\table_sel"): TWACs_Number = row.getValue("TWACs_Number") out_graph_name = n out_graph_pdf = r"C:\Temp" + "\\" + str(n) + ".pdf" input_template = r"C:\Temp\KW Demand.grf" input_data = r"in_memory\table_sel" # Create the graph graph = arcpy.Graph() # Add a vertical bar series to the graph graph.addSeriesBarVertical(input_data, "KW_DEMAND") # Specify the title of the left axis graph.graphAxis[0].title = "KW Demand" # Specify the title of the bottom axis graph.graphAxis[2].title = "Meter Number" # Specify the title of the Graph graph.graphPropsGeneral.title = TWACs_Number # Output a graph, which is created in-memory arcpy.MakeGraph_management(input_template, graph, out_graph_name) # Save the graph as a PDF arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)
Just ran into the same problem and am wondering if there is a workaround?
Thanks.
Fred
Chris,I believe I was assisting your before. I think the title of the axis's being lowercase is a bug. I was able to reproduce this same behavior. I would recommend following up with Tech Support.As for the title, you can use the 'getValue' method to retrieve the value of your field. Ex:import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\temp\data.gdb" table = "Meters" fields = ["METER_NUMBER"] list = [] rows = arcpy.SearchCursor(table) for row in rows: list.append(row.METER_NUMBER) del row, rows #remove duplicates from list list = dict.fromkeys(list) list = list.keys() for n in list: arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + str(n)) #get TWACs_Number value for row in arcpy.SearchCursor(r"in_memory\table_sel"): TWACs_Number = row.getValue("TWACs_Number") out_graph_name = n out_graph_pdf = r"C:\Temp" + "\\" + str(n) + ".pdf" input_template = r"C:\Temp\KW Demand.grf" input_data = r"in_memory\table_sel" # Create the graph graph = arcpy.Graph() # Add a vertical bar series to the graph graph.addSeriesBarVertical(input_data, "KW_DEMAND") # Specify the title of the left axis graph.graphAxis[0].title = "KW Demand" # Specify the title of the bottom axis graph.graphAxis[2].title = "Meter Number" # Specify the title of the Graph graph.graphPropsGeneral.title = TWACs_Number # Output a graph, which is created in-memory arcpy.MakeGraph_management(input_template, graph, out_graph_name) # Save the graph as a PDF arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.