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


JavaScript ArcGIS Legend.hideLayersNotInCurrentView用法及代碼示例

基本信息

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

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

ESM: import Legend from "@arcgis/core/widgets/Legend";

類: esri/widgets/Legend

繼承: Legend > Widget > Accessor

自從:用於 JavaScript 4.0 的 ArcGIS API

用法說明

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

hideLayersNotInCurrentView Boolean


自從:ArcGIS 適用於 JavaScript 4.21 的 API

true 時,隻有在視圖範圍內可見的圖層才會顯示在圖例中。當圖層中的數據在視圖中不可見時,圖層的圖例信息將被隱藏。

要從圖例中完全隱藏圖層,您應該將圖層的 legendEnabled 屬性設置為 false

默認值:false

例子:

// layers not displayed in the view
// will not be shown in the legend
legend.hideLayersNotInCurrentView = true;

相關用法


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