<?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: Dynamically filter data shown in a Chart widget in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1571259#M16668</link>
    <description>&lt;P&gt;&lt;STRONG&gt;To filter data in your Experience Builder chart:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Find the data source:&lt;/STRONG&gt; Figure out where your chart gets its information (it's likely a "Feature Service").&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Let users choose filters:&lt;/STRONG&gt; Use widgets like text boxes or dropdowns to let users select how they want to filter the data.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Write a smart SQL query:&lt;/STRONG&gt; Create an SQL query that changes based on what the user selects.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Tell the chart to use the new query:&lt;/STRONG&gt; Apply the query to your chart's data source.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Refresh the chart:&lt;/STRONG&gt; Make the chart display the filtered data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const textBox = app.getWidgetById('textbox1');
const chartWidget = app.getWidgetById('chart1');
const featureServiceDataSource = chartWidget.dataSource;
textBox.on('change', (event) =&amp;gt; {
  const userInput = event.target.value; 

  
  const sqlQuery = `YourFieldName = '${userInput}'`;

  
  featureServiceDataSource.setQuery({
    where: sqlQuery,
    outFields: ['*'],
  });

  
  chartWidget.refresh();

  console.log(`Applied SQL query: ${sqlQuery}`);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Dec 2024 04:15:07 GMT</pubDate>
    <dc:creator>SumitMishra_016</dc:creator>
    <dc:date>2024-12-26T04:15:07Z</dc:date>
    <item>
      <title>Dynamically filter data shown in a Chart widget</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1571232#M16666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I use a custom SQL query with a Feature Service data source in Experience Builder to dynamically filter data shown in a Chart widget based on user input?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2024 10:42:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1571232#M16666</guid>
      <dc:creator>JAYAKUMARKUMAR</dc:creator>
      <dc:date>2024-12-25T10:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically filter data shown in a Chart widget</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1571259#M16668</link>
      <description>&lt;P&gt;&lt;STRONG&gt;To filter data in your Experience Builder chart:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Find the data source:&lt;/STRONG&gt; Figure out where your chart gets its information (it's likely a "Feature Service").&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Let users choose filters:&lt;/STRONG&gt; Use widgets like text boxes or dropdowns to let users select how they want to filter the data.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Write a smart SQL query:&lt;/STRONG&gt; Create an SQL query that changes based on what the user selects.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Tell the chart to use the new query:&lt;/STRONG&gt; Apply the query to your chart's data source.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Refresh the chart:&lt;/STRONG&gt; Make the chart display the filtered data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const textBox = app.getWidgetById('textbox1');
const chartWidget = app.getWidgetById('chart1');
const featureServiceDataSource = chartWidget.dataSource;
textBox.on('change', (event) =&amp;gt; {
  const userInput = event.target.value; 

  
  const sqlQuery = `YourFieldName = '${userInput}'`;

  
  featureServiceDataSource.setQuery({
    where: sqlQuery,
    outFields: ['*'],
  });

  
  chartWidget.refresh();

  console.log(`Applied SQL query: ${sqlQuery}`);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 04:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1571259#M16668</guid>
      <dc:creator>SumitMishra_016</dc:creator>
      <dc:date>2024-12-26T04:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically filter data shown in a Chart widget</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1665953#M21641</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/760068"&gt;@SumitMishra_016&lt;/a&gt;&amp;nbsp;can you please explain more about this?&amp;nbsp; Are you suggesting to add text or drop down widgets in addition to the chart widget, or to configure the query within the chart widget?&amp;nbsp; thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Nov 2025 18:14:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/dynamically-filter-data-shown-in-a-chart-widget/m-p/1665953#M21641</guid>
      <dc:creator>JanetSilb_Spike</dc:creator>
      <dc:date>2025-11-14T18:14:30Z</dc:date>
    </item>
  </channel>
</rss>

