POST
|
@KenBuja is correct. You should use the Expects function for this case if using a for loop. The rendering engine for Online (JS API) is optimized for performance. So it only requests the data that's required by the layer's style by default. If you specify a field outside of an Arcade expression, the API knows to request data from that field for rendering. In the case of Arcade, the expression is evaluated for the fields required to make it work. When $feature.FIELDNAME is used, it's easy for the engine to figure out the required fields. That's why the alternative expression works. However, you can use Expects to directly tell the rendering engine which fields it should expect to request from the service. This can be a list of fields as Ken points out, or you can also define template strings like the following: Expects("*"); // requests all fields. Don't do this if you have a ton of attributes.
Expects("Year_*") // requests all fields that begin with "Year_". (e.g. "Year_2000", "Year_2010") would be requested, but "Y2004" wouldn't). On a side note, you could take advantage of the number function to condense the initial expression like this: Expects($feature,'*_20*');
var fieldList = ['Dorian_2019','Sally_2020','Ian_2022','Nicole_2022','Idalia_2023'];
var total = 0;
for (var f in fieldList) {
// adds 1 if "YES"
// adds 0 if not "YES"
total += Number($feature[fieldList[f]] == 'YES');
}
return total; Or use the reduce function to avoid a for loop altogether. You still need Expects for this to work... Expects($feature,'*_20*');
var fieldList = ['Dorian_2019','Sally_2020','Ian_2022','Nicole_2022','Idalia_2023'];
function add (total, fieldName){ total + Number($feature[fieldName] == 'YES') }
Reduce(fieldList, add, 0);
... View more
11-06-2023
09:05 AM
|
3
|
2
|
741
|
IDEA
|
The UniqueValueInfo.description is intentionally left out of the documentation as it does not have a use in the current API. You should use the label property in stead of the description.
... View more
09-12-2023
08:31 AM
|
0
|
0
|
233
|
POST
|
> the still undocumented JSON structure for specifying it with uniqueValueGroups The JSON structure has actually been documented in the web map specification ever since the concept was introduced. You can find it here: https://developers.arcgis.com/web-map-specification/objects/uniqueValueRenderer/ https://developers.arcgis.com/web-map-specification/objects/uniqueValueGroup/ https://developers.arcgis.com/web-map-specification/objects/uniqueValueClass/ It includes examples with multiple scenarios. Perhaps we should improve the JS documentation to link to the web map specification.
... View more
08-31-2023
03:00 PM
|
0
|
1
|
378
|
POST
|
I'm not observing this behavior. If you think you're encountering a bug, you should reach out to Esri support with a repro/test case so they can vet it and log it into our system to fix it more promptly. Here's the test case I tried that appeared to work: https://codepen.io/kekenes/pen/yLQMYPx?editors=100
... View more
06-27-2023
02:40 PM
|
1
|
0
|
175
|
POST
|
This sounds like a potential bug in the rendering engine. I advise reaching out to Esri Support so they can validate the issue and get it logged into our system.
... View more
06-23-2023
09:16 AM
|
0
|
0
|
564
|
POST
|
It could be. I also don't think we save renderers directly to the service anymore (on the Online side anyway). It would be worth checking in with someone on the Pro/Enterprise side...
... View more
06-15-2023
11:55 AM
|
0
|
1
|
627
|
POST
|
Can you share the difference in renderer JSON saved to the service versus the renderer on the layer's portal item? It seems to be related to that.
... View more
06-15-2023
11:27 AM
|
0
|
0
|
633
|
POST
|
Yeah, I see the issue, but it's a bit of a confusing one... It's in the where clause of the Filter function. That where statement is a SQL where, and doesn't allow Arcade functions. So this bit: "DATE_HEURE > Date(2023-05-01)" Needs to change to: "DATE_HEURE > '2023-05-01'" Then it should work... Here's an example: https://codepen.io/kekenes/pen/NWOJapJ?editors=100
... View more
05-25-2023
07:03 AM
|
0
|
0
|
316
|
POST
|
Yes. This is possible. You need to query the features within the bin and create a column chart representing however you partition the data. This sample demonstrates how to query features inside a bin using Arcade: https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning-arcade-summary/ In the popup, click one of the arrows next to the pie chart to see a similar visualization using a line chart. This chart displays the number of crimes that occurred in each month within the bin. This blog also steps you through the process: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/how-to-summarize-aggregate-data-using-arcade-in-popups/
... View more
05-23-2023
09:51 AM
|
0
|
0
|
367
|
POST
|
The first scenario works because passing an array of strings to the values property is a convenience pattern when you're only working with one value. The second example is using incorrect syntax. You can't pass an array to values.value or values.value2. The values property takes an array of objects, like this... That way you can pair up values that go together in a const renderer = {
type: "unique-value",
field: "test1",
field2: "test2",
uniqueValueGroups: [{
heading: "Heading 1",
classes: [{
label: "Label 1",
symbol: {
type: "simple-marker",
style: "circle",
color: "#58ff60",
outline: {
color: "rgba(140,255,120,0.5)",
width: 6
}
},
values: [{
value: "testValue"
}, {
value: "testValue1",
}, {
value2: "testValve2"
}]
}, {
label: "Label 2",
symbol: {
type: "simple-marker",
style: "circle",
color: "#58ff60",
outline: {
color: "rgba(140,255,120,0.5)",
width: 6
}
},
values: {
value: "testValue3",
value2: "testValve4"
}
}]
}]
} Or if you want field1 and field2 values combined to represent one category, you specify the values for each within a single object. values: [{
value: "testValu1",
value2: "testValue2"
}, {
value: "testValue3",
}, {
value2: "testValve4"
}]
... View more
05-19-2023
04:08 PM
|
0
|
4
|
479
|
POST
|
1. I need more detail here. Specifically, what are the more complex cases? Is it just that you have more categories? 3. I think you misunderstood that line of documentation. Individual features are displayed. That line is specifying how those features get their symbol. If you specify a cluster renderer, all features (clusters and individual features) are styled using the cluster renderer. That is what is meant by "cluster renderer overrides the style of the features in the view". If you don't specify a cluster renderer, the cluster style is inferred from the layer renderer, which determines how individual features are styled. This isn't a change we're going to revert. The previous behavior is wrong even if that's what you were used to. Many people called support pointing this out and requesting this change. I suggest using the pie chart style in your scenario. If I see a lot of default symbols in clusters in a scenario like this, that tells me that pie chart is more appropriate anyway since there is no clear pattern of predominance. You also have options for how many categories to display in pie chart clusters...and individual features will display with the color of the category to which they belong as a solid color. Since the behavior was incorrect previously, I don't consider this a breaking change. If you notice strong visual differences in this scenario with clustering when upgrading the API version, it's exposing the problems we had in previous versions of the API, rather than the introduction of a bug in newer versions.
... View more
05-11-2023
10:41 AM
|
0
|
1
|
619
|
POST
|
This is actually a result of a bug "fix" related to cluster visualizations with unique value renderer. Neither visual is great in my opinion. Without a cluster renderer, the cluster uses the symbol of the most common category (or uniqueValueInfo) contained within the cluster. Your dataset involves tie values. Prior to 4.25, in the case of a tie where the most common category was in a tie with another category, the rendering engine just picked one of the symbols and used it. This is problematic since it portrays predominance in one category when it doesn't actually exist. At 4.25, we updated this to match our predominance renderer for layers so tie values are represented with the default symbol. I don't think this is a perfect solution as the default symbol makes it look like the features don't belong to any of the categories. There are a couple of things you can do to change the visual. 1. Use a pie chart renderer for the cluster style. This will show the actual breakdown of categories within the cluster. This is great for scenarios where predominance can be misleading even when tie values are not involved. However, it can make it hard to read if a lot of categories are in play. In your scenario, where there are only 3 categories (a fourth being tie values), I think this is a fine option. 2. You can update the defaultSymbol on the layer style and indicate it represents "tie values" by setting a defaultLabel. 3. You can override the default cluster renderer with your own unique value renderer accounting for ties using a distinct symbol. Hopefully that helps.
... View more
05-08-2023
10:56 AM
|
1
|
4
|
660
|
POST
|
You cannot use SummaryStatistics for binning before first creating the bins in a view. The binning implementation is purely client-side, so the bins must first be created before they can be queried for statistics. You can use SummaryStatistics to query a feature layer that hasn't yet been added to a map because the statistics query can be sent to the feature server. Because we don't have a server-side binning solution at the moment, the same cannot be done here. If you're trying to query stats before bins display, I suggest you create the bins with a transparent symbol first, then issue the query and create the renderer and apply to the feature reduction object. That way you won't see flashing when the app starts up.
... View more
04-24-2023
09:28 AM
|
1
|
0
|
261
|
POST
|
Yes. You can use those values in your stops. You first have to initialize binning then query the bins before creating the stops for the renderer. You can do this on your own using the summaryStatistics method, or you can use the smart mapping renderer creators to generate the stops for you based on the statistics. https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-color.html It's the same parameters, but instead of outputting stats, it outputs a renderer.
... View more
04-14-2023
11:21 AM
|
1
|
0
|
455
|
POST
|
Yes. You can do this with the smartMapping statistic functions. In this case you need summaryStatistics. You can also get a histogram and unique values with count if needed. You just need to be sure to set the forBinning parameter to true. const stats = await summaryStatistics({
layer,
view,
field: "aggregateCount",
forBinning: true
}); Here's a codepen that demonstrates how to do it for the basic configuration sample you posted: https://codepen.io/kekenes/pen/bGmEvWj?editors=1000 Let me know if you run into issues.
... View more
04-13-2023
11:47 AM
|
1
|
0
|
467
|
Title | Kudos | Posted |
---|---|---|
1 | 03-02-2024 01:02 PM | |
1 | 02-21-2024 10:46 AM | |
2 | 02-20-2024 02:53 PM | |
1 | 11-30-2023 12:01 PM | |
3 | 11-06-2023 09:05 AM |
Online Status |
Offline
|
Date Last Visited |
a month ago
|