當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS predominantCategories.predominantCategories用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/smartMapping/statistics/predominantCategories"], (predominantCategories) => { /* code goes here */ });

ESM: import predominantCategories from "@arcgis/core/smartMapping/statistics/predominantCategories";

函數: esri/smartMapping/statistics/predominantCategories

自從:用於 JavaScript 4.13 的 ArcGIS API

用法說明

predominantCategories.predominantCategories函數(或屬性)的定義如下:

predominantCategories (params) {Promise<PredominantCategoriesResult>}


根據給定的一組競爭數字字段確定圖層的主要類別,並返回屬於每個類別的要素數。

參數:

規格:
類型說明
params Object

有關每個參數的詳細信息,請參見下表。

規格:

為給定的 fields 集生成主要類別的層。

fields

String[]

用於確定主要類別的數字字段數組。這些字段必須都是數字字段,並且它們必須是競爭的或互補的(例如,按家庭使用的語言計算的人口總數,或按裁剪類型劃分的收獲麵積,或候選人或政黨的選舉結果)。

可選的

將在其中呈現要素的視圖。

signal

AbortSignal

可選的

允許可取消的請求。如果取消,promise 將被拒絕,並出現名為 AbortError 的錯誤。另見AbortController

返回:

類型 說明
Promise<PredominantCategoriesResult> 返回解析為 PredominantCategoriesResult 的 Promise。

例子:

predominantCategories({
  layer: featureLayer,
  fields: [ "corn_acres", "cotton_acres", "wheat_acres", "soybeans_acres", "vegetables_acres" ],
  view: mapView
}).then(function(stats){
  console.log(stats.predominantCategoryInfos);
});

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 predominantCategories.predominantCategories。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。