plainheart / echarts-extension-amap

🚩 An AMap (https://lbs.amap.com) extension for Apache ECharts (https://github.com/apache/echarts)
https://github.com/plainheart/echarts-extension-amap
MIT License
251 stars 83 forks source link

点集合MarkerClusterer如何支持? #8

Closed xcqwan closed 4 years ago

xcqwan commented 4 years ago

高德文档: https://lbs.amap.com/api/javascript-api/guide/overlays/massmarker

plainheart commented 4 years ago

这些的使用方法跟高德API是一样的,获取到高德地图实例后可随意使用。

// 获取高德地图实例
var amap = chart.getModel().getComponent("amap").getAMap();
var style = [
  {
      url: 'https://a.amap.com/jsapi_demos/static/images/mass0.png',
      anchor: new AMap.Pixel(6, 6),
      size: new AMap.Size(11, 11)
  }, {
      url: 'https://a.amap.com/jsapi_demos/static/images/mass1.png',
      anchor: new AMap.Pixel(4, 4),
      size: new AMap.Size(7, 7)
  }, {
      url: 'https://a.amap.com/jsapi_demos/static/images/mass2.png',
      anchor: new AMap.Pixel(3, 3),
      size: new AMap.Size(5, 5)
  }
];
var mass = new AMap.MassMarks(citys, {
    opacity: 0.8,
    zIndex: 111,
    cursor: 'pointer',
    style: style
});
mass.setMap(amap);

image

xcqwan commented 4 years ago

@plainheart 感谢回复🙏。使用这种方法是可以的。这种是在amap上绘制散点图,然后点聚合也是在amap基础上做。其实我想问的是另外一种,以amap做底图,使用echarts来绘制散点图(type: 'scatter'), 这种如何做点聚合?

plainheart commented 4 years ago

这个恐怕得自己做聚合算法,监听地图缩放事件,动态更新ECharts散点图的data。