I made a Python toolbox with a simple tool for testing arcpy's charting functionality in Pro. I'm trying to plot a line chart from these data, which I imported into a geodatabase as a table:
I have a map named "Map" with the above table as the first table in the map. Here's the tool class's execute method:
def execute(self, parameters, messages): aprx = arcpy.mp.ArcGISProject("current") map = aprx.listMaps("Map") table = map.listTables() c = arcpy.Chart('MyChart') c.type = 'line' c.xAxis.field = 'x' c.yAxis.field = 'y' c.addToLayer(table) return
When I run the tool, a chart is added as shown below the table in the Table of Contents, but when I open the chart, instead of a chart I see "Select Variable(s) in the Chart Properties pane to begin". But the chart properties pane does show the variables selected.
If I uncheck and then re-check "y" in the numeric fields list and click Apply, nothing happens. If I right-click the table to manually create a new chart, the chart previously created by my GP tool disappears.