twp0217 / ngx-echarts

Apache ECharts component for Angular(基于 Angular 的 Apache ECharts 组件)
https://twp0217.github.io/ngx-echarts/
82 stars 25 forks source link

如何使用bmap #30

Closed wzy156917847 closed 6 years ago

wzy156917847 commented 6 years ago

使用bmp的时候显示不出来,是要引入百度地图文件吗

twp0217 commented 6 years ago

稍等,晚上研究下再答复

wzy156917847 commented 6 years ago

好的、非常感谢

twp0217 commented 6 years ago
  1. 在index.html引入
    <!--引入百度地图的jssdk,这里需要使用你在百度地图开发者平台申请的 ak-->
    <script src="http://api.map.baidu.com/api?v=2.0&ak="></script>

    2.在使用的component.ts,引入地图JS

    import 'echarts/extension/bmap/bmap';

    3.设置option

    option = {
    bmap: {
      center: [116.46, 39.92],
      zoom: 11.8,
      roam: true,
      mapStyle: {
        styleJson: [{
          'featureType': 'water',
          'elementType': 'all',
          'stylers': {
            'color': '#d1d1d1'
          }
        }, {
          'featureType': 'land',
          'elementType': 'all',
          'stylers': {
            'color': '#f3f3f3'
          }
        }, {
          'featureType': 'railway',
          'elementType': 'all',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'highway',
          'elementType': 'all',
          'stylers': {
            'color': '#999999'
          }
        }, {
          'featureType': 'highway',
          'elementType': 'labels',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'arterial',
          'elementType': 'geometry',
          'stylers': {
            'color': '#fefefe'
          }
        }, {
          'featureType': 'arterial',
          'elementType': 'geometry.fill',
          'stylers': {
            'color': '#fefefe'
          }
        }, {
          'featureType': 'poi',
          'elementType': 'all',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'green',
          'elementType': 'all',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'subway',
          'elementType': 'all',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'manmade',
          'elementType': 'all',
          'stylers': {
            'color': '#d1d1d1'
          }
        }, {
          'featureType': 'local',
          'elementType': 'all',
          'stylers': {
            'color': '#d1d1d1'
          }
        }, {
          'featureType': 'arterial',
          'elementType': 'labels',
          'stylers': {
            'visibility': 'off'
          }
        }, {
          'featureType': 'boundary',
          'elementType': 'all',
          'stylers': {
            'color': '#fefefe'
          }
        }, {
          'featureType': 'building',
          'elementType': 'all',
          'stylers': {
            'color': '#d1d1d1'
          }
        }, {
          'featureType': 'label',
          'elementType': 'labels.text.fill',
          'stylers': {
            'color': 'rgba(0,0,0,0)'
          }
        }]
      }
    }
    };
wzy156917847 commented 6 years ago

啊啊啊 原来是路径引错了 谢谢您

wzy156917847 commented 6 years ago

您好,麻烦再问您一个问题 在引入之后您遇到这个问题了吗?不能够用百度地图里面的类 image

wzy156917847 commented 6 years ago

解决了 谢谢

twp0217 commented 6 years ago

解决方案是什么,发上来共享下吧

wzy156917847 commented 6 years ago

抱歉,刚刚看到 声明一个全局任意类型变量 image