{"id":1216462,"date":"2021-06-02T12:17:44","date_gmt":"2021-06-02T19:17:44","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=1216462"},"modified":"2024-01-30T10:27:19","modified_gmt":"2024-01-30T18:27:19","slug":"making-charts-more-class-y-with-the-new-arcpy-charts-module","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module","title":{"rendered":"Making Charts More Class-y with the New arcpy.charts Module!"},"author":157441,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[40691,42181,31181,30821],"industry":[],"product":[36561],"class_list":["post-1216462","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-analytics","tag-arcgis-pro","tag-arcpy","tag-charts","product-arcgis-pro"],"acf":{"short_description":"Learn more about the new arcpy.charts module that is available in ArcGIS Pro 2.8!","flexible_content":[{"acf_fc_layout":"content","content":"<p>ArcGIS Pro 2.8 includes a new <code>arcpy.charts<\/code> module with new classes that significantly improve the experience of creating and configuring charts through ArcPy. This new API provides a number of advantages over the old API, including:<\/p>\n<ul>\n<li>Adding new chart-specific classes to make charting more object oriented<\/li>\n<li>Making the syntax for configuring charts cleaner and more convenient<\/li>\n<li>Organizing the new classes into an <code>arcpy.charts<\/code> module<\/li>\n<\/ul>\n<p>Still unsure about how this changes the ArcPy charting experience? Hopefully a quick example will help. Here&#8217;s a code snippet from a previous <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/using-arcgis-notebooks-and-arcpy-charts-to-explore-data\/\">blog post<\/a> that creates and configures a bar chart with the original ArcPy charts API:<\/p>\n<pre><code>c = arcpy.Chart(<span style=\"color: #ba2121\">'bar_covid_by_state'<\/span>)\r\nc.type = <span style=\"color: #ba2121\">'bar'<\/span>\r\nc.title = <span style=\"color: #ba2121\">\"Total COVID Cases by State\"<\/span>\r\nc.xAxis.field = <span style=\"color: #ba2121\">'state'<\/span>\r\nc.xAxis.title= <span style=\"color: #ba2121\">\"State\"<\/span>\r\nc.yAxis.field = <span style=\"color: #ba2121\">'cases_new'<\/span>\r\nc.yAxis.title = <span style=\"color: #ba2121\">\"Cases\"<\/span>\r\nc.bar.aggregation = <span style=\"color: #ba2121\">'sum'<\/span>\r\nc.dataSource = <span style=\"color: #ba2121\">'memory\/covid_daily'<\/span><\/code><\/pre>\n<p>Notice that you first create a generic <code>Chart<\/code> object, then specify the chart type, and finally set each parameter line-by-line. While this code works perfectly fine, setting each parameter line-by-line can be a bit cumbersome. Let&#8217;s take a look at how you would create the same chart using the new API:<\/p>\n<pre><code>c = arcpy.charts.Bar(x=<span style=\"color: #ba2121\">'state'<\/span>, y=<span style=\"color: #ba2121\">'cases_new'<\/span>, aggregation=<span style=\"color: #ba2121\">'sum'<\/span>,\r\n                     title=<span style=\"color: #ba2121\">\"Total COVID Cases by State\"<\/span>,\r\n                     xTitle=<span style=\"color: #ba2121\">\"State\"<\/span>, yTitle=<span style=\"color: #ba2121\">\"Cases\"<\/span>,\r\n                     dataSource=<span style=\"color: #ba2121\">'memory\/covid_daily'<\/span>)\r\n<\/code><\/pre>\n<p>Here, I&#8217;m creating the chart by instantiating a <code>Bar<\/code> object from the <code>arcpy.charts<\/code> module, and I&#8217;m configuring it by setting the arguments in the class constructor. This approach follows a more object-oriented design and allows you to set many parameters in one easy step, rather than tediously setting each parameter line-by-line. Now you can be more productive by writing cleaner and more efficient code!<\/p>\n<p>For more code samples and details about the capabilities of the new ArcPy chart classes, we encourage you to check out the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/charts\/what-is-the-charts-module.htm\">documentation page<\/a> for the <code>arcpy.charts<\/code> module. We hope that you&#8217;ll try the new API in your next Python project and see the benefit of this streamlined and object-oriented approach!<\/p>\n<p>&nbsp;<\/p>\n"}],"authors":[{"ID":157441,"user_firstname":"Christopher","user_lastname":"Allen","nickname":"Christopher Allen","user_nicename":"callen","display_name":"Chris Allen","user_email":"callen@esri.com","user_url":"","user_registered":"2021-01-13 22:34:06","user_description":"Chris is a product engineer on the Pro Charts team, where he puts his background in GIS, data science, and visualization to good use.  In his free time, Chris enjoys taking walks, supporting the Milwaukee Bucks, and watching old episodes of Huell Howser on PBS.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/01\/ca_smaller-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":"","card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/06\/barn-images-t5YUoHW6zRo-unsplash-1.jpg","wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/06\/barn-images-t5YUoHW6zRo-unsplash.jpg"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Making Charts More Class-y with the New arcpy.charts Module!<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Making Charts More Class-y with the New arcpy.charts Module!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-30T18:27:19+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\"},\"author\":{\"name\":\"Chris Allen\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/56dfaef3f02a3ce06f957e1efa80057b\"},\"headline\":\"Making Charts More Class-y with the New arcpy.charts Module!\",\"datePublished\":\"2021-06-02T19:17:44+00:00\",\"dateModified\":\"2024-01-30T18:27:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\"},\"wordCount\":10,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"analytics\",\"ArcGIS Pro\",\"ArcPy\",\"charts\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\",\"name\":\"Making Charts More Class-y with the New arcpy.charts Module!\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2021-06-02T19:17:44+00:00\",\"dateModified\":\"2024-01-30T18:27:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Making Charts More Class-y with the New arcpy.charts Module!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/56dfaef3f02a3ce06f957e1efa80057b\",\"name\":\"Chris Allen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/01\/ca_smaller-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/01\/ca_smaller-213x200.jpg\",\"caption\":\"Chris Allen\"},\"description\":\"Chris is a product engineer on the Pro Charts team, where he puts his background in GIS, data science, and visualization to good use. In his free time, Chris enjoys taking walks, supporting the Milwaukee Bucks, and watching old episodes of Huell Howser on PBS.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/callen\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Making Charts More Class-y with the New arcpy.charts Module!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module","og_locale":"en_US","og_type":"article","og_title":"Making Charts More Class-y with the New arcpy.charts Module!","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2024-01-30T18:27:19+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module"},"author":{"name":"Chris Allen","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/56dfaef3f02a3ce06f957e1efa80057b"},"headline":"Making Charts More Class-y with the New arcpy.charts Module!","datePublished":"2021-06-02T19:17:44+00:00","dateModified":"2024-01-30T18:27:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module"},"wordCount":10,"commentCount":3,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["analytics","ArcGIS Pro","ArcPy","charts"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module","name":"Making Charts More Class-y with the New arcpy.charts Module!","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2021-06-02T19:17:44+00:00","dateModified":"2024-01-30T18:27:19+00:00","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/making-charts-more-class-y-with-the-new-arcpy-charts-module#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Making Charts More Class-y with the New arcpy.charts Module!"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/56dfaef3f02a3ce06f957e1efa80057b","name":"Chris Allen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/01\/ca_smaller-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/01\/ca_smaller-213x200.jpg","caption":"Chris Allen"},"description":"Chris is a product engineer on the Pro Charts team, where he puts his background in GIS, data science, and visualization to good use. In his free time, Chris enjoys taking walks, supporting the Milwaukee Bucks, and watching old episodes of Huell Howser on PBS.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/callen"}]}},"text_date":"June 2, 2021","author_name":"Chris Allen","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/callen","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/06\/barn-images-t5YUoHW6zRo-unsplash.jpg","primary_product":"ArcGIS Pro","tag_data":[{"term_id":40691,"name":"analytics","slug":"analytics","term_group":0,"term_taxonomy_id":40691,"taxonomy":"post_tag","description":"","parent":0,"count":53,"filter":"raw"},{"term_id":42181,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":42181,"taxonomy":"post_tag","description":"","parent":0,"count":323,"filter":"raw"},{"term_id":31181,"name":"ArcPy","slug":"arcpy","term_group":0,"term_taxonomy_id":31181,"taxonomy":"post_tag","description":"","parent":0,"count":32,"filter":"raw"},{"term_id":30821,"name":"charts","slug":"charts","term_group":0,"term_taxonomy_id":30821,"taxonomy":"post_tag","description":"","parent":0,"count":46,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1325,"filter":"raw"}],"product_data":[{"term_id":36561,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":36561,"taxonomy":"product","description":"","parent":0,"count":2035,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-pro","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1216462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/157441"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=1216462"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1216462\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=1216462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=1216462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=1216462"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=1216462"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=1216462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}