antv-l7/docs/api/react/layer.zh.md

1.3 KiB
Raw Blame History

title order
Layer 组件 1

Scene Props

prop name Type Default Description
option Object layer配置项
source 数据源配置项
color attributeOption 颜色通道
shape attributeOption 图层形状属性
size attributeOption 图层大小属性
style Object 图层样式
scale Object 图层度量
filter Function 图层数据过滤方法
select boolean Object 图层选中高亮
active boolean Object false 图层hover高亮
onLayerLoad Function 图层添加完成后回调用于获取layer对象

attributeOption

color, size, shape 等图形映射通道配置项

option

  • field 映射字段,如果是常量设置为 null
  • values 映射值 支持 常量数组回调函数如果values为数组或回调需要设置field字段

sourceOption

数据源配置项

Option

  • data 支持 geojson、csv、json
  • parser 数据解析配置项
  • transforms 数据处理配置项
import {PolygonLayer } from '@antv/l7-react';
<PolygonLayer
  key={'2'}
  source={{
    data,
  }}
  color={{
    field: 'name',
    values: [
      '#2E8AE6',
      '#69D1AB',
      '#DAF291',
      '#FFD591',
      '#FF7A45',
      '#CF1D49',
    ],
  }}
  shape={{
    values: 'fill',
  }}
  style={{
    opacity: 1,
  }}
/>