Select to view content in your preferred language

export chart

518
1
Jump to solution
01-07-2023 02:05 AM
pspada_WT
New Contributor III

Hi,

I've a CIMChart object. There is some way with pro SDK to export it as image?

0 Kudos
1 Solution

Accepted Solutions
ChristopherAllen
Esri Contributor

Hi @pspada_WT ,

Thanks for the question! Unfortunately, there is not currently an official Charts API for the Pro SDK and therefore there isn't any functionality to export a chart graphic. Please feel free to upvote the Pro Idea here if you would like to see a Charts API for the SDK (including export functionality): 

https://community.esri.com/t5/arcgis-pro-ideas/add-public-charting-classes-to-arcgis-pro-sdk/idi-p/9...

I wanted to point out that creating and exporting a chart as an SVG file is possible with the arcpy.charts module if Python is an option for you. Here's an example that creates a bar chart an exports as SVG:

 

import arcpy
url = r"https://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/CrimesChiTheft/FeatureServer/0"
bar = arcpy.charts.Bar(x="BEAT", aggregation="count", title="Chicago Thefts by Beat", dataSource=url)
bar.exportToSVG('bar.svg', width=800, height=500)

 

 

Also, if you're able to share more details about your use case for exporting charts, we might be able to brainstorm alternative solutions. 

Thanks!

Chris

View solution in original post

1 Reply
ChristopherAllen
Esri Contributor

Hi @pspada_WT ,

Thanks for the question! Unfortunately, there is not currently an official Charts API for the Pro SDK and therefore there isn't any functionality to export a chart graphic. Please feel free to upvote the Pro Idea here if you would like to see a Charts API for the SDK (including export functionality): 

https://community.esri.com/t5/arcgis-pro-ideas/add-public-charting-classes-to-arcgis-pro-sdk/idi-p/9...

I wanted to point out that creating and exporting a chart as an SVG file is possible with the arcpy.charts module if Python is an option for you. Here's an example that creates a bar chart an exports as SVG:

 

import arcpy
url = r"https://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/CrimesChiTheft/FeatureServer/0"
bar = arcpy.charts.Bar(x="BEAT", aggregation="count", title="Chicago Thefts by Beat", dataSource=url)
bar.exportToSVG('bar.svg', width=800, height=500)

 

 

Also, if you're able to share more details about your use case for exporting charts, we might be able to brainstorm alternative solutions. 

Thanks!

Chris