<?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: Custom chart with bars and lines in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036718#M4243</link>
    <description>&lt;P&gt;Hi Josh, you are right about the required format of the table with months in rows and the water supply/demand values in columns. In the xls form. however, the value of each month for each kind of water supply/demand is calculated separately and therefore is its own field.&amp;nbsp; I am struggling with how to get the values in the format I need.&lt;/P&gt;&lt;P&gt;One thing I tried was create a separate survey using repeat , filled it manually and it spat out the table in the format I need. However, I need the process to run automatically and haven't quite figured out how to make the repeat function run automatically. Would appreciate any suggestions&lt;/P&gt;</description>
    <pubDate>Mon, 15 Mar 2021 17:17:58 GMT</pubDate>
    <dc:creator>PrachiPatel</dc:creator>
    <dc:date>2021-03-15T17:17:58Z</dc:date>
    <item>
      <title>Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1021805#M4159</link>
      <description>&lt;P&gt;I want to create a chart that looks like the screenshot below. The three demands need to be stacked bar charts and the supply information need to be lines. The value for each demand and supply is calculated for each month and is its own field in the underlying feature layer. The underlying feature layer is an output of a published survey 123 survey that uses submitter input such as project area and project users to calculate the supplies and demands in the project. Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrachiPatel_0-1611961178323.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/4946i40948E445F919E64/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrachiPatel_0-1611961178323.png" alt="PrachiPatel_0-1611961178323.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 23:04:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1021805#M4159</guid>
      <dc:creator>PrachiPatel</dc:creator>
      <dc:date>2021-01-29T23:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1021836#M4160</link>
      <description>&lt;P&gt;A chart like that may be possible, depending on how the data is set up. Can you elaborate on the chart, though? Are those monthly values being aggregated from multiple rows in the table?&lt;/P&gt;&lt;P&gt;The only way I'm aware of to do aggregated values in a serial chart is to use the &lt;STRONG&gt;Grouped Values&lt;/STRONG&gt; option, and you're only able to aggregate a &lt;EM&gt;single&lt;/EM&gt; field. In order to reference multiple fields in a single chart, you have to use the &lt;STRONG&gt;Features&lt;/STRONG&gt; option, but then you end up with a separate set of bars for ever row in your table. &lt;STRONG&gt;Fields&lt;/STRONG&gt; can aggregate multiple fields, but not separate them by the date.&lt;/P&gt;&lt;P&gt;In order to accomplish the chart you have pictured there, you'd need a separate table with a row for each month, and have the aggregated values populating the fields. Then you'd be able to use the &lt;STRONG&gt;Features&lt;/STRONG&gt; option and achieve what you're going for.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2021 02:30:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1021836#M4160</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-01-30T02:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036718#M4243</link>
      <description>&lt;P&gt;Hi Josh, you are right about the required format of the table with months in rows and the water supply/demand values in columns. In the xls form. however, the value of each month for each kind of water supply/demand is calculated separately and therefore is its own field.&amp;nbsp; I am struggling with how to get the values in the format I need.&lt;/P&gt;&lt;P&gt;One thing I tried was create a separate survey using repeat , filled it manually and it spat out the table in the format I need. However, I need the process to run automatically and haven't quite figured out how to make the repeat function run automatically. Would appreciate any suggestions&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 17:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036718#M4243</guid>
      <dc:creator>PrachiPatel</dc:creator>
      <dc:date>2021-03-15T17:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036730#M4244</link>
      <description>&lt;P&gt;I think this could still be doable with a separate standalone table, but it would have to be done outside of Survey123. Imagine a layer like this:&lt;/P&gt;&lt;PRE&gt;Month | Potable | Stormwater | etc. | etc.&lt;BR /&gt;------|---------|------------|------|-----&lt;BR /&gt;Jan   |     1000|         900|   250|   25  &lt;BR /&gt;Feb   |     1250|        1100|   100|   33&lt;/PRE&gt;&lt;P&gt;You could have an automated process pull the values from the main survey dataset, aggregate each value by month, then submit the values to the table. Point the serial chart at that table, and you can symbolize it the way you want.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 17:28:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036730#M4244</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-15T17:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036908#M4247</link>
      <description>&lt;P&gt;Yes, After reading your previous response , I created a table to do so and can create a chart, that is not stacked, but it a combination of lines and bars. Now I need to figure out how to automate the creation of that table because I want the dashboard to update every time a submitter hits submit on the survey 123 survey. Figuring the automation out.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrachiPatel_0-1615846692418.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8534i5C36376503439A5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrachiPatel_0-1615846692418.png" alt="PrachiPatel_0-1615846692418.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 22:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036908#M4247</guid>
      <dc:creator>PrachiPatel</dc:creator>
      <dc:date>2021-03-15T22:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036970#M4249</link>
      <description>&lt;P&gt;Glad to hear it! The &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#featurelayer" target="_self"&gt;ArcGIS Python API&lt;/A&gt; and &lt;A href="https://pandas.pydata.org/pandas-docs/stable/index.html" target="_self"&gt;Pandas&lt;/A&gt; will be your friends for the automation portion. We do a similar process for updating a few standalone tables, and here's what it looks like, roughly:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

gis = GIS('portal-url', 'user', 'password')

# The survey
survey_layer = gis.content.get('survey-itemID').layers[0]

# The table
chart_table = gis.content.get('chart-table-itemID').tables[0]

# Query the survey layer to a dataframe
all_the_data = survey_layer.query(as_df=True)

# Do whatever aggregating / reshaping you need to
# This section will look different depending on what you're doing
agg_data = all_the_data.groupby('grouping_field').sum()

# Truncate and append table records
chart_table.manager.truncate()
chart_table.edit_features(adds=agg_data.spatial.to_featureset())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should be general enough to adapt to your particular needs. Then just get that script called up with a Task Scheduler to run at regular intervals and you'll never have to think about it again!&lt;/P&gt;&lt;P&gt;Also, since Survey tends to have editor tracking fields present by default, you could pre-query the layer to see if any new submissions have been added since the last script run, and just skip the whole process if there is no new data.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 01:48:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1036970#M4249</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-16T01:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1046382#M4337</link>
      <description>&lt;P&gt;Thanks for this solution, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;! I was able to work with&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/219131"&gt;@PrachiPatel&lt;/a&gt; to write a script using the template you provided.&lt;/P&gt;&lt;P&gt;Instead of setting up a recurring task, I stored it as a Google Cloud Function and then added the URL of the function as a webhook that runs when the survey is submitted. There's a blog post that explains doing this here: &lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/calling-python-scripts-with-survey123-integromat-and-google/ba-p/898980" target="_blank"&gt;Calling Python scripts with Survey123, Integromat,... - Esri Community&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this code to get the object id of the submitted survey.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;def update_table(request):
  request_json = request.get_json(silent=True)
  object_id = request_json['feature']['result']['objectId']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, instead of truncating and recreating the entire chart_table, I filtered the survey_layer by the object id, did my reshaping on just the submitted row, and added the reshaped rows to the chart_table.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;survey_data = survey_layer.query(where='objectid = ' + str(object_id), as_df=True)

# In this section (omitted) the submitted row gets pivoted to 12 rows (one per month)

chart_table.edit_features(adds=pivoted_data.spatial.to_featureset())&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Apr 2021 15:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1046382#M4337</guid>
      <dc:creator>Aubrey_Drescher</dc:creator>
      <dc:date>2021-04-13T15:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1046479#M4338</link>
      <description>&lt;P&gt;That's fantastic! I may end up using that in a future project, so thank you for documenting it so well!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 17:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1046479#M4338</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-13T17:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1493967#M9821</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/219131"&gt;@PrachiPatel&lt;/a&gt;&amp;nbsp;Were you able to figure out to create a serial chart in Dashboards with BOTH bars and lines? I have not been able to do this, even with aggregated data. I would appreciate any insights if you made this happen. Thank you!&lt;/P&gt;&lt;P&gt;Janet&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 20:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1493967#M9821</guid>
      <dc:creator>JanetBrewster1</dc:creator>
      <dc:date>2024-06-17T20:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Custom chart with bars and lines</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1503369#M9942</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/69432"&gt;@JanetBrewster1&lt;/a&gt;&amp;nbsp;, The chart I was able to make has bars and lines, but the bars represent a single field instead of a stacked bar representing multiple fields. So instead of stacking the bars with data from 4 types of demand, I just have a single bar showing non-potable demand only per month, and then the lines show various non potable supplies per month.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 01:57:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/custom-chart-with-bars-and-lines/m-p/1503369#M9942</guid>
      <dc:creator>PrachiPatel</dc:creator>
      <dc:date>2024-07-10T01:57:43Z</dc:date>
    </item>
  </channel>
</rss>

