代码
const map = new BMap.Map('map');
map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
map.setTilt(45);
map.setMapStyle({
  styleJson: darkStyle,
  merge: true,
});

const data = {
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      properties: {name: '东城区', value: [72, 96, 58, 44], height: 20250},
      geometry: {type: 'Point', coordinates: [116.418, 39.917]},
    },
    {
      type: 'Feature',
      properties: {name: '西城区', value: [68, 104, 62, 48], height: 21150},
      geometry: {type: 'Point', coordinates: [116.366, 39.912]},
    },
    {
      type: 'Feature',
      properties: {name: '朝阳区', value: [98, 92, 86, 76], height: 26400},
      geometry: {type: 'Point', coordinates: [116.486, 39.921]},
    },
    {
      type: 'Feature',
      properties: {name: '丰台区', value: [88, 64, 54, 62], height: 20100},
      geometry: {type: 'Point', coordinates: [116.287, 39.858]},
    },
    {
      type: 'Feature',
      properties: {name: '石景山区', value: [54, 48, 42, 46], height: 14250},
      geometry: {type: 'Point', coordinates: [116.223, 39.906]},
    },
    {
      type: 'Feature',
      properties: {name: '海淀区', value: [94, 78, 96, 72], height: 25500},
      geometry: {type: 'Point', coordinates: [116.298, 39.959]},
    },
    {
      type: 'Feature',
      properties: {name: '门头沟区', value: [46, 42, 40, 44], height: 12900},
      geometry: {type: 'Point', coordinates: [116.102, 39.94]},
    },
    {
      type: 'Feature',
      properties: {name: '房山区', value: [76, 58, 48, 66], height: 18600},
      geometry: {type: 'Point', coordinates: [116.143, 39.749]},
    },
    {
      type: 'Feature',
      properties: {name: '通州区', value: [86, 72, 64, 58], height: 21000},
      geometry: {type: 'Point', coordinates: [116.658, 39.902]},
    },
    {
      type: 'Feature',
      properties: {name: '顺义区', value: [74, 66, 58, 68], height: 19950},
      geometry: {type: 'Point', coordinates: [116.654, 40.13]},
    },
    {
      type: 'Feature',
      properties: {name: '昌平区', value: [92, 74, 70, 64], height: 22500},
      geometry: {type: 'Point', coordinates: [116.235, 40.221]},
    },
    {
      type: 'Feature',
      properties: {name: '大兴区', value: [88, 70, 66, 72], height: 22200},
      geometry: {type: 'Point', coordinates: [116.338, 39.729]},
    },
    {
      type: 'Feature',
      properties: {name: '怀柔区', value: [52, 46, 44, 50], height: 14400},
      geometry: {type: 'Point', coordinates: [116.637, 40.316]},
    },
    {
      type: 'Feature',
      properties: {name: '平谷区', value: [56, 50, 44, 52], height: 15150},
      geometry: {type: 'Point', coordinates: [117.112, 40.144]},
    },
    {
      type: 'Feature',
      properties: {name: '密云区', value: [60, 52, 46, 54], height: 15900},
      geometry: {type: 'Point', coordinates: [116.843, 40.377]},
    },
    {
      type: 'Feature',
      properties: {name: '延庆区', value: [48, 44, 42, 46], height: 13500},
      geometry: {type: 'Point', coordinates: [115.985, 40.465]},
    },
  ],
};

const layer = new BMap.BarLayer({
  renderStage: 'poi',
  color: [
    'rgba(0, 100, 255, 1)',
    'rgba(0, 200, 200, 1)',
    'rgba(0, 200, 100, 1)',
    'rgba(255, 200, 0, 1)',
  ],
  size: 2000,
});
layer.setData(data);
map.addLayer(layer);

value 和 color 可以配置成数组,支持多段展示

预览