Incubator-echarts: echart中使用bmap,无法限制zoom级别

Created on 20 Oct 2017  ·  2Comments  ·  Source: apache/incubator-echarts

One-line summary [问题简述]

在echart中使用bmap的空气质量地图,请问有限制地图缩放级别的api吗? 例如百度地图中的
var map = new BMap.Map("allmap",{minZoom:4,maxZoom:8});
而且我查看了api,只能在实例化的时候设置,这可如何是好!!
请大神指点

Version & Environment [node6.11.8]

  • ECharts version [ECharts 3.7.2]:
  • Browser version [Chrome/61.0.3163.91]:
  • OS Version [win10]:

Expected behaviour [期望结果]

在bmap空气质量地图中限制 地图的缩放等级,例如只能缩放8-11级

ECharts option [ECharts配置项]


option = {
          backgroundColor: '#404a59',
          title: {
            text: '',
            subtext: '',
            sublink: '',
            left: 'center',
            textStyle: {
              color: '#fff'
            }
          },
          tooltip: {
            trigger: 'item'
          },
          bmap: {
            center: [104.114129, 37.550339],
            roam: true,
            mapStyle: {
              styleJson: [
                {
                  'featureType': 'water',
                  'elementType': 'all',
                  'stylers': {
                    'color': '#183d95'
                  }
                },
                {
                  'featureType': 'land',
                  'elementType': 'all',
                  'stylers': {
                    'color': '#0f275f'
                  }
                },
                {
                  'featureType': 'boundary',
                  'elementType': 'all',
                  'stylers': {
                    'color': '#3f69c8'
                  }
                },
                {
                  'featureType': 'railway',
                  'elementType': 'all',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'highway',
                  'elementType': 'geometry',
                  'stylers': {
                    'color': '#004981',
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'highway',
                  'elementType': 'geometry.fill',
                  'stylers': {
                    'color': '#005b96',
                    'lightness': 1,
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'highway',
                  'elementType': 'labels',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'arterial',
                  'elementType': 'geometry',
                  'stylers': {
                    'color': '#004981',
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'arterial',
                  'elementType': 'geometry.fill',
                  'stylers': {
                    'color': '#00508b',
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'poi',
                  'elementType': 'all',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'green',
                  'elementType': 'all',
                  'stylers': {
                    'color': '#056197',
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'subway',
                  'elementType': 'all',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'manmade',
                  'elementType': 'all',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'local',
                  'elementType': 'all',
                  'stylers': {
                    'visibility': 'off'
                  }
                },
                {
                  'featureType': 'boundary',
                  'elementType': 'geometry.fill',
                  'stylers': {
                    'color': '#3f69c8'
                  }
                },
                {
                  'featureType': 'label',
                  'elementType': 'labels.text.stroke',
                  'stylers': {
                    'color': '#eee'
                  }
                }
              ]
            }
          },
          series: [
            {
              name: 'danger',
              type: 'effectScatter',
              coordinateSystem: 'bmap',
              data: convertData(data.filter(function (k) {
                if (k.status === 'danger') {
                  return k
                }
              })),
              symbolSize: function (val) {
                return 10
              },
              rippleEffect: {
                brushType: 'stroke'
              },
              hoverAnimation: true,
              label: {
                normal: {
                  formatter: '{b}',
                  position: 'right',
                  show: false
                },
                emphasis: {
                  show: true
                }
              },
              itemStyle: {
                normal: {
                  color: '#fc4c7c'
                }
              }
            },
            {
              name: 'warning',
              type: 'effectScatter',
              coordinateSystem: 'bmap',
              data: convertData(data.filter(function (k) {
                if (k.status === 'warning') {
                  return k
                }
              })),
              symbolSize: function (val) {
                return 8
              },
              rippleEffect: {
                brushType: 'stroke'
              },
              hoverAnimation: true,
              label: {
                normal: {
                  formatter: '{b}',
                  position: 'right',
                  show: false
                },
                emphasis: {
                  show: true
                }
              },
              itemStyle: {
                normal: {
                  color: '#f79752'
                }
              }
            }
          ]
}

Other comments [其他信息]


stale

Most helpful comment

暂时可以这么处理:

BMap = myChart.getModel().getComponent('bmap').getBMap();
BMap.setMinZoom(12);
BMap.setMaxZoom(19);

All 2 comments

暂时可以这么处理:

BMap = myChart.getModel().getComponent('bmap').getBMap();
BMap.setMinZoom(12);
BMap.setMaxZoom(19);

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings