<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to alphabetically sort bar chart category by domain code in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708711#M23501</link>
    <description>&lt;P&gt;The age old problem of "natural sort" not being offered as a standard option in most soft&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Natural_sort_order" target="_blank"&gt;Natural sort order - Wikipedia&lt;/A&gt;&lt;/P&gt;&lt;P&gt;simple to implement in some circumstances, but I think not for yours.&amp;nbsp; Simply cast the text-numbers to integer or float, then sort, keeping the order&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = np.array(['0', '1', '11', '111', '2', '22', '222', '3', '33', '333'], dtype='&amp;lt;U3')

np.sort(a)  # -- doesn't work, lexicographic sort only
array(['0', '1', '11', '111', '2', '22', '222', '3', '33', '333'], dtype='&amp;lt;U3')

np.astype(a, int)  # -- cast it to integers for example
array([  0,   1,  11, 111,   2,  22, 222,   3,  33, 333])

b = np.sort(np.astype(a, int))  

b = np.sort(np.astype(a, int))  # -- sort, the integer representation looks correct
array([  0,   1,   2,   3,  11,  22,  33, 111, 222, 333])

c = np.astype(b, str)  # -- back to text if desired
array(['0', '1', '2', '3', '11', '22', '33', '111', '222', '333'], dtype='&amp;lt;U21')

# the a, b, c's of natural sorting&lt;/LI-CODE&gt;&lt;P&gt;might want to create an Idea to incorporate natural sorting options where you need them&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2026 21:14:44 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2026-06-17T21:14:44Z</dc:date>
    <item>
      <title>Unable to alphabetically sort bar chart category by domain code</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708632#M23500</link>
      <description>&lt;P&gt;I have a bar chart configured to show a count by category: incident type.&lt;/P&gt;&lt;P&gt;The incident type field is &lt;STRONG&gt;text&lt;/STRONG&gt;, with the following domain codes and labels (notice that the labels aren't in alphabetical order, and the codes also aren't sortable as numbers due to being text; this part is out of my hands for the moment):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NicoleJohnson_0-1781708011633.png" style="width: 265px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153945i602534FE988C688D/image-dimensions/265x465?v=v2" width="265" height="465" role="button" title="NicoleJohnson_0-1781708011633.png" alt="NicoleJohnson_0-1781708011633.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In other products (outside of Experience Builder), the codes are always presented in this order, so I would like to stay consistent with that.&lt;/P&gt;&lt;P&gt;I'm able to do that &lt;EM&gt;some&lt;/EM&gt; way everywhere I'm using them in Experience Builder&amp;nbsp;&lt;EM&gt;except&lt;/EM&gt; for this bar chart, which seems to be treating the codes invariably as numbers?&lt;/P&gt;&lt;P&gt;Here is what the chart looks like, with the first few categories labeled with their underlying domain code. For the sake of consistency with other products, I would prefer that 11 come after 1, 9 be at the bottom of the chart instead of before 11, etc.:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NicoleJohnson_4-1781709747131.png" style="width: 612px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153950iD5544B125450F08A/image-dimensions/612x407?v=v2" width="612" height="407" role="button" title="NicoleJohnson_4-1781709747131.png" alt="NicoleJohnson_4-1781709747131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;(The data is public, but I'm limiting what I share for the sake of distraction from the issue this post is about)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/chart-widget.htm#:~:text=or%20descending%20order.-,Prefer%20to%20use%20label,-%E2%80%94When%20you%20sort" target="_self"&gt;The chart widget documentation&lt;/A&gt;&amp;nbsp;has ("by category" applies to me):&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Sort by&lt;/SPAN&gt;&lt;/STRONG&gt;—Sort the chart by values or category name, in ascending or descending order.&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Prefer to use label&lt;/SPAN&gt;&lt;/STRONG&gt;—When you sort by category, you can choose a method for further sorting categories. In&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;By field&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mode, check the check box to sort by field label (alias) and uncheck the check box to sort by field name. In&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;By category&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mode, check the check box to sort by attribute label (description) and uncheck the check box to sort by attribute code (coded domain).&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I thought maybe unchecking the "prefer to use label" setting would do what I need, but the chart doesn't actually change when I uncheck it.&amp;nbsp;I can't get either an alphabetical sort based on the label OR an alphabetical sort based on the code. &lt;STRONG&gt;What am I misunderstanding about this setting? It clearly wasn't sorting the labels before I unchecked it, so I'm confused about what it's supposed to do, if anyone has used it with success and can provide an example?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/in-arcgis-experience-builder-the-chart-widget-sorts-dat-bug-000173142" target="_self"&gt;This bug&lt;/A&gt;&amp;nbsp;sounds a bit like what I'm dealing with, but it was fixed in Feb. 2026.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how the data and series are configured:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Weirdly enough, if I change the statistics setting to "sum," I can at least get the labels A-Z, but I'm not able to do that &lt;STRONG&gt;everywhere&lt;/STRONG&gt; else (like in a table), so it's not really a solution.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NicoleJohnson_5-1781709981900.png" style="width: 241px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153951i6F9C061C0281B2D5/image-dimensions/241x599?v=v2" width="241" height="599" role="button" title="NicoleJohnson_5-1781709981900.png" alt="NicoleJohnson_5-1781709981900.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NicoleJohnson_6-1781710008586.png" style="width: 253px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153952iB9089AC4FD02ED2D/image-dimensions/253x382?v=v2" width="253" height="382" role="button" title="NicoleJohnson_6-1781710008586.png" alt="NicoleJohnson_6-1781710008586.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 15:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708632#M23500</guid>
      <dc:creator>NicoleJohnson</dc:creator>
      <dc:date>2026-06-17T15:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to alphabetically sort bar chart category by domain code</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708711#M23501</link>
      <description>&lt;P&gt;The age old problem of "natural sort" not being offered as a standard option in most soft&lt;/P&gt;&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Natural_sort_order" target="_blank"&gt;Natural sort order - Wikipedia&lt;/A&gt;&lt;/P&gt;&lt;P&gt;simple to implement in some circumstances, but I think not for yours.&amp;nbsp; Simply cast the text-numbers to integer or float, then sort, keeping the order&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = np.array(['0', '1', '11', '111', '2', '22', '222', '3', '33', '333'], dtype='&amp;lt;U3')

np.sort(a)  # -- doesn't work, lexicographic sort only
array(['0', '1', '11', '111', '2', '22', '222', '3', '33', '333'], dtype='&amp;lt;U3')

np.astype(a, int)  # -- cast it to integers for example
array([  0,   1,  11, 111,   2,  22, 222,   3,  33, 333])

b = np.sort(np.astype(a, int))  

b = np.sort(np.astype(a, int))  # -- sort, the integer representation looks correct
array([  0,   1,   2,   3,  11,  22,  33, 111, 222, 333])

c = np.astype(b, str)  # -- back to text if desired
array(['0', '1', '2', '3', '11', '22', '33', '111', '222', '333'], dtype='&amp;lt;U21')

# the a, b, c's of natural sorting&lt;/LI-CODE&gt;&lt;P&gt;might want to create an Idea to incorporate natural sorting options where you need them&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 21:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708711#M23501</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2026-06-17T21:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to alphabetically sort bar chart category by domain code</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708758#M23504</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/606665"&gt;@NicoleJohnson&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Try sorting in the domain settings in the data tab.&lt;/P&gt;&lt;P&gt;Data/Fields/{Field}/Edit domain list.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EMani_0-1781770871301.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153988iA4ECAB69242D70B9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EMani_0-1781770871301.png" alt="EMani_0-1781770871301.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 08:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708758#M23504</guid>
      <dc:creator>EMani</dc:creator>
      <dc:date>2026-06-18T08:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to alphabetically sort bar chart category by domain code</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708817#M23505</link>
      <description>&lt;P&gt;Unfortunately they're already in the order I "want" them to be in, but I meant to check this and totally forgot, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 12:11:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/unable-to-alphabetically-sort-bar-chart-category/m-p/1708817#M23505</guid>
      <dc:creator>NicoleJohnson</dc:creator>
      <dc:date>2026-06-18T12:11:48Z</dc:date>
    </item>
  </channel>
</rss>

