Class: ColorVariable

ColorVariable

new ColorVariable(options)

document/renderer/visualVariable/ColorVariable.js, line 6

color视觉变量

Name Type Description
options Object

初始化参数

Name Type Description
stops Array.<ColorStop> 可选

颜色分段数组

Example
color视觉变量使用方式
// 获取layer上renderer对象
 const renderer = layer.renderer
// 根据FID取值设置#FFFCD4到#350242的过渡颜色值
// FID取值小于0时,显示颜色#FFFCD4
// FID取值大于200时,显示颜色#350242
// FID取值在0-200之间时,显示颜色过渡值
 renderer.visualVariables = [{
            type: "color",
            valueExpression: "$feature.FID",
            stops: [
              {
                color: "#FFFCD4",
                value: 0,
              },
              {
                color: "#350242",
                value: 200,
              },
            ],
          }]

Members

stopsArray.<ColorStop>

归一化字段

Methods

ColorVariable.fromJSON(){ColorVariable}

document/renderer/visualVariable/ColorVariable.js, line 53

通过json构造ColorVariable对象

Returns:
Type Description
ColorVariable json对象

clone(){ColorVariable}

document/renderer/visualVariable/ColorVariable.js, line 73

克隆对象

Returns:
Type Description
ColorVariable 克隆后的ColorVariable对象

toJSON(){Object}

document/renderer/visualVariable/ColorVariable.js, line 61

导出为json对象

Returns:
Type Description
Object json对象