1

Does ArcGIS Pro afford the ability to batch create chart elements?

I am aware of how to create a single chart by selecting the table in the TOC, right click and "create chart". I can select the "series" group that I want to show in that chart (such that I can hide the lines for series groups that I do not want shown).

My table has dozens of sites with multiple test results and test dates. My need is to produce the same format chart for each of my sites. Only showing data for a single site on each chart. I can then manually add the chart(s) to the layout as needed. I'm picturing a GP tool to create chart element.

1 Answer 1

2

Yes - if you write out the arcpy code to do it.

You can make use of the Charts class

You could either write some code to re-run in the Python window, or build a full script tool with input parameters. See the following code from copy/paste. You'd need to modify the values to fit your workflow.

aprx = arcpy.mp.ArcGISProject("current")
map = aprx.listMaps()[0]
censusLayer = map.listLayers('Census Block Groups')[0]
c = arcpy.Chart('MyChart')

c.type = 'scatter'
c.title = 'Relationship between Percent Vacant (Housing) and Population Density'
c.description = 'This chart examines the relationship between housing vacancy and population density.'
c.xAxis.field = 'Per_Vacant'
c.yAxis.field = 'Pop_Density'
c.xAxis.title = 'Vacant Housing %'
c.yAxis.title = 'Population Density (per Sq. Mile)'
c.addToLayer(censusLayer)
3
  • correct me if I'm wrong, but this does not appear to create new charts, right? It modifies an existing one?
    – Zipper1365
    Commented Jun 22, 2020 at 16:59
  • Nope. Creates new charts.(Although, you can use this method to update existing) Each chart is attached to the layer. You may want to do a new c = arcpy.Chart('MyChart') for each, so a, a, b, c, variable, etc.
    – KHibma
    Commented Jun 22, 2020 at 17:09
  • indeed, it created a new chart. I can work with this.
    – Zipper1365
    Commented Jun 22, 2020 at 18:24

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.