antvis / LarkMap

A React toolkit for geospatial visualization based on L7.

Home Page:https://larkmap.antv.antgroup.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐛 ChoroplethLayer组件的onCreated方法中监听不到legend的变化

Dreammy23 opened this issue · comments

/### 使用ChoroplethLayer行政区下钻组件时,想监听 legend 改变的方法,发现没有生效

<ChoroplethLayer
      id="boundsLayer"
       autoFit: true,
       fillColor: {
         field: 'predictsValue',
         value: [
          '#fadfce',
          '#ffbb96', 
          '#ff8f5b',
          '#fc6e35',
          '#f03c21',
        ]
      },
      zIndex: 0,
      opacity: 0.8,
      lineWidth: 1,
      label: {
        field: 'areaName',
        visible: true,
        style: { fill: 'black', fontSize: 12, stroke: '#fff', strokeWidth: 1 },
      },
      source={{ data: boundData }}
      onCreated={(layer) => {
        layer?.on('legend:color', () => console.log('监听legend:color')); // 无效,没有打印语句
        layer?.on('legend', () => console.log('监听legend')); // 无效,没有打印语句
        layer?.on('dataUpdate', () => console.log('监听legend')); // 生效,有打印语句
      }}
    />