<?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: How to customize pie chart slice colors in chart component in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1706112#M88500</link>
    <description>&lt;P&gt;Are you checking the slices array after the chart.refresh();&amp;nbsp; If so you would want to add an await and then check.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;await chart.refresh();
console.log(chart.model.slices);&lt;/LI-CODE&gt;&lt;P&gt;If that doesn't work try adding an&amp;nbsp;arcgisRenderingComplete event to the chart.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/references/charts-components/components/arcgis-chart/#event-arcgisRenderingComplete" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/references/charts-components/components/arcgis-chart/#event-arcgisRenderingComplete&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2026 21:04:51 GMT</pubDate>
    <dc:creator>Justin_Greco</dc:creator>
    <dc:date>2026-06-03T21:04:51Z</dc:date>
    <item>
      <title>How to customize pie chart slice colors in chart component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1704451#M88478</link>
      <description>&lt;P&gt;I have a chart component in a mapping app that renders a pie chart based on a feature layer. However, I don't like how the automatic coloring scheme results in adjacent slices sometimes bearing the same color:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LouisaMeyerson_1-1779824490159.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153043iA7E2BF09888ADEAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LouisaMeyerson_1-1779824490159.png" alt="LouisaMeyerson_1-1779824490159.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is it possible to overwrite the colors of the chart's slices after they're generated? I'm aware of the pie-chart-model's getSliceColor() and setSliceColor() methods but the slices array is undefined whenever I try to access it or use slice-related methods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 19:50:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1704451#M88478</guid>
      <dc:creator>LouisaMeyerson</dc:creator>
      <dc:date>2026-05-26T19:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize pie chart slice colors in chart component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1705148#M88487</link>
      <description>&lt;P&gt;Could you post the code you have? &amp;nbsp;I have used the chart components, but just by loading from a web map, so all the configuration wasn’t done through code.&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2026 11:35:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1705148#M88487</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2026-05-29T11:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize pie chart slice colors in chart component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1705663#M88494</link>
      <description>&lt;P&gt;Sure. I use JS to dynamically update the layer associated with the arcgis-chart component with this function, and it's called whenever a new feature layer is created through interacting with the site (as opposed to being called once when the page is loaded). Most of the code just configures the chart model with the settings that I want. Let me know if there's any other code I could provide.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Import modules
const [{createModel}] = await $arcgis.import([
  "@arcgis/charts-components",
]);

// Creates pie chart based on provided feature layer
const chart = document.querySelector('arcgis-chart');
export async function createChart(layer, view){
  // Create pie chart
  const chartModel = await createModel({layer: layer, chartType: "pieChart"});
  chartModel.category = 'genus';
  chartModel.chartTitleVisibility = false;
  chartModel.fetchNULLValues = true;
  chartModel.groupingThreshold = 1;
  chartModel.config.series[0].numericValueFormat = {
    type: 'number',
    intlOptions: {
      maximumFractionDigits: 0,
      minimumFractionDigits: 0
    }
  };

  // Populate chart element with pie chart
  chart.model = chartModel;
  chart.refresh();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2026 14:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1705663#M88494</guid>
      <dc:creator>LouisaMeyerson</dc:creator>
      <dc:date>2026-06-02T14:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize pie chart slice colors in chart component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1706112#M88500</link>
      <description>&lt;P&gt;Are you checking the slices array after the chart.refresh();&amp;nbsp; If so you would want to add an await and then check.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;await chart.refresh();
console.log(chart.model.slices);&lt;/LI-CODE&gt;&lt;P&gt;If that doesn't work try adding an&amp;nbsp;arcgisRenderingComplete event to the chart.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/references/charts-components/components/arcgis-chart/#event-arcgisRenderingComplete" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/references/charts-components/components/arcgis-chart/#event-arcgisRenderingComplete&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 21:04:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1706112#M88500</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2026-06-03T21:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize pie chart slice colors in chart component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1706286#M88504</link>
      <description>&lt;P&gt;Thanks for your response. I tried both of your suggestions and unfortunately, chart.model.slices is still undefined after the chart is finished rendering.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 16:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-customize-pie-chart-slice-colors-in-chart/m-p/1706286#M88504</guid>
      <dc:creator>LouisaMeyerson</dc:creator>
      <dc:date>2026-06-04T16:07:30Z</dc:date>
    </item>
  </channel>
</rss>

