Hi all,
I have a question about how to add two indications on the same serial chart: I want to combine the solved and the total number of features at the same chart.
Well, you can use a Data Expression to do this, too. Basically, you'd pull in the reports layer and throw them all into a "total" category, and then take the solved ones and add them again. This should enable you to visualize the chart the way you'd like.
var portal = Portal('your portal url') // Get reports featureset var fs = FeatureSetByPortalItem( portal, 'itemid of your service', 0, // or whatever layer index the specific layer is at ['status', 'report_date'], false ) // Output dictionary var out_dict = { fields: [ {name: 'type', type: 'esriFieldTypeString'}, {name: 'report_date', type: 'esriFieldTypeDate'} ], geometryType: '', features: [] } // Iterate over features for (var f in fs){ // Add feature to output dict as a "total" type Push( out_dict['features'], { attributes: { type: 'Total', report_date: Number(f['report_date']) // You need to cast the date as a number to be correctly interpreted } } ) // If report is a "solved" type, add it again If (f['status'] == 'solved'){ Push( out_dict['features'], { attributes: { type: 'Solved', report_date: Number(f['report_date']) // You need to cast the date as a number to be correctly interpreted } } ) } } // Convert dict to FeatureSet return FeatureSet(Text(out_dict))
I used this expression with a sample FeatureSet that had the following records:
Since "solved" records are added twice, the output FeatureSet had 10 records in it, and I was able to make this chart:
How is the data organized? There's no reason you shouldn't be able to do this, but it depends on where the data's coming from and what it looks like. Is "solved" a field?
I have a layer for reports, and it has a field called "status" which contains values(received, processing, and solved).
I want to make a serial chart, per day, for the solved features on a line and the total of all features(received, processing, and solved) on another line.
So I used a chart for grouped values by category "date", then split by the field "status", but this way did not give me the desired output.
Thank you so much
@jcarlson it works, but after I click done, it gives me "no data" on the dashboard
You mean it shows you the data when you're configuring the chart? Or it only shows it in the Expression Builder?
it shows the data on the chart only while configuring the chart
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.