基本信息
以下是所在類或對象的基本信息。
AMD:
require(["esri/popup/ElementExpressionInfo"], (ElementExpressionInfo) => { /* code goes here */ });
ESM:
import ElementExpressionInfo from "@arcgis/core/popup/ElementExpressionInfo";
類:
esri/popup/ElementExpressionInfo
繼承: ElementExpressionInfo > Accessor
自從:用於 JavaScript 4.22 的 ArcGIS API
用法說明
定義用於在 PopupTemplate 中創建 ExpressionContent 元素的 Arcade 表達式。表達式必須計算為 dictionary ,表示 TextContent 、 FieldsContent 或 MediaContent 彈出元素,如 Popup Element web map specification 中定義。
此表達式可以使用 $feature
、 $layer
、 $map
和 $datastore
全局變量從Map或數據存儲中的要素、其圖層或其他圖層訪問數據值。有關有效返回字典的更多信息和示例,請參閱Popup Element Arcade Profile 規範。
例子:
// Creates an ordered list in a cluster's popup
// listing the type of fuel used to generate power in the cluster
// ordered by the total number of power plants for each fuel type.
layer.featureReduction = {
type: "cluster",
popupTemplate: {
title: "Power plant summary",
content: [{
type: "expression",
expressionInfo: {
expression: `
// Specify which fields are required by the expression
Expects($aggregatedFeatures, "fuel1", "capacity_mw")
// Query stats for each fuel type
var statsFS = GroupBy($aggregatedFeatures,
[
{ name: 'Type', expression: 'fuel1'},
],
[ // statistics to return for each unique category
{ name: 'capacity_total', expression: 'capacity_mw', statistic: 'SUM' },
{ name: 'capacity_max', expression: 'capacity_mw', statistic: 'MAX' },
{ name: 'num_features', expression: '1', statistic: 'COUNT' }
]
);
// create an list in descending order based
// on the number of plants for each fuel type.
var ordered = OrderBy(statsFs, 'num_features DESC');
var list = "<ol>";
for (var group in ordered){
list += \`<li>\${group.Type} (\${Text(group.num_features, "#,###")})</li>\`
}
list += "</ol>";
// The return dictionary must return a text, fields, or media
// popup element as defined in the web map specification
return {
type: "text",
text: list
}
`,
title: "List of fuel types"
}
}]
}
};
相關用法
- JavaScript ArcGIS ElementExpressionInfo.expression用法及代碼示例
- JavaScript ArcGIS Element.visibilityExpression用法及代碼示例
- JavaScript ArcGIS ElevationProfile.profiles用法及代碼示例
- JavaScript ArcGIS ElevationLayer.fullExtent用法及代碼示例
- JavaScript ArcGIS ElevationLayer layerview-create-error事件用法及代碼示例
- JavaScript ArcGIS ElevationLayer.on用法及代碼示例
- JavaScript ArcGIS ElevationProfile.visibleElements用法及代碼示例
- JavaScript ArcGIS ElevationSampler.on用法及代碼示例
- JavaScript ArcGIS ElevationLayer用法及代碼示例
- JavaScript ArcGIS ElevationProfile.when用法及代碼示例
- JavaScript ArcGIS ElevationProfile.container用法及代碼示例
- JavaScript ArcGIS ElevationProfile.classes用法及代碼示例
- JavaScript ArcGIS ElevationLayer layerview-create事件用法及代碼示例
- JavaScript ArcGIS ElevationLayer.portalItem用法及代碼示例
- JavaScript ArcGIS ElevationProfile用法及代碼示例
- JavaScript ArcGIS ElevationLayer.visible用法及代碼示例
- JavaScript ArcGIS ElevationLayer.when用法及代碼示例
- JavaScript ArcGIS ElevationLayer.queryElevation用法及代碼示例
- JavaScript ArcGIS ElevationProfile.on用法及代碼示例
- JavaScript ArcGIS ElevationLayer.url用法及代碼示例
- JavaScript ArcGIS ElevationSampler changed事件用法及代碼示例
- JavaScript ArcGIS ElevationSampler用法及代碼示例
- JavaScript ArcGIS ElevationProfile.visible用法及代碼示例
- JavaScript ArcGIS Expand.when用法及代碼示例
- JavaScript ArcGIS ExtrudeSymbol3DLayer.castShadows用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 ElementExpressionInfo。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。