BIGEMPA Js API示例中心

柱形图源代码展示

代码编辑区 运行 下载 还原
<!DOCTYPE html>
<html>
<head>
    <meta charset='UTF-8' />
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
    <!--
        以下CSS地址请在安装软件了替换成本地的地址
        CSS地址请使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.css
        软件下载地址 http://www.bigemap.com/reader/download/detail201802017.html
    -->
    <link href='http://www.bigemap.com:9000/bigemap.js/v2.1.0/bigemap.css' rel='stylesheet' />
    <!--
        JS地址请使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.js
    -->
    <script src='http://www.bigemap.com:9000/bigemap.js/v2.1.0/bigemap.js'></script>

    <script type="text/javascript" src="https://gallerybox.echartsjs.com/dep/echarts/latest/echarts.min.js"></script>
    <script src="/Public/offline/iclient/js/iclient9.min.js"></script>
    <style>
        body { margin: 0; padding: 0;}
        #map { position: absolute; top: 0; bottom: 0; width: 100%; }
    </style>
    <title>Google Map Streets</title>
</head>
<body>
<div id='map'></div>
<script>
    //软件配置信息地址,软件安装完成之后使用本地地址,如:http://localhost:9000
    BM.Config.HTTP_URL = 'http://www.bigemap.com:9000';
    // 在ID为map的元素中实例化一个地图,并设置地图的ID号为 bigemap.googlemap-streets,ID号程序自动生成,无需手动配置,并设置地图的投影为百度地图 ,中心点,默认的级别和显示级别控件
    var map = BM.map('map','bigemap.googlemap-satellite', { center: [32, 108], zoom: 4, zoomControl: true,attributionControl:false });
    var option = {
        legend: {
            data: ['降雨量', '径流量'],
            align: 'left'
        },
        toolbox: {
            feature: {
                magicType: {
                    type: ['stack', 'tiled']
                },
                saveAsImage: {
                    pixelRatio: 2
                }
            }
        },
        tooltip: {},
        xAxis: {
            data: ['周一','周二','周三','周四','周五','周六','周日'],
            silent: false,
            splitLine: {
                show: false
            }
        },
        yAxis: {},
        series: [{
            name: '降雨量',
            type: 'bar',
            animationDelay: function (idx) {
                return idx * 10;
            }
        }, {
            name: '径流量',
            type: 'bar',
            animationDelay: function (idx) {
                return idx * 10 + 100;
            }
        }],
        animationEasing: 'elasticOut',
        animationDelayUpdate: function (idx) {
            return idx * 5;
        }
    };
    var div = BM.DomUtil.create('div');
    var chart = echarts.init(div, '', {
        width: 500,
        height: 300
    });
    chart.setOption(option);
    var places=[{"name":"甘肃","position":[36.03,103.73]},{"name":"青海","position":[36.56,101.74]},{"name":"四川","position":[30.67,104.06]},{"name":"河北","position":[38.03,114.48]},{"name":"云南","position":[25.04,102.73]},{"name":"贵州","position":[26.57,106.71]},{"name":"湖北","position":[30.52,114.31]},{"name":"河南","position":[34.76,113.65]},{"name":"山东","position":[36.65,117]},{"name":"江苏","position":[32.04,118.78]},{"name":"安徽","position":[31.86,117.27]},{"name":"浙江","position":[30.26,120.19]},{"name":"江西","position":[28.68,115.89]},{"name":"福建","position":[26.08,119.3]},{"name":"广东","position":[23.16,113.23]},{"name":"湖南","position":[28.21,113]},{"name":"海南","position":[20.02,110.35]},{"name":"辽宁","position":[41.8,123.38]},{"name":"吉林","position":[43.88,125.35]},{"name":"黑龙江","position":[45.75,126.63]},{"name":"山西","position":[37.87,112.53]},{"name":"陕西","position":[34.27,108.95]},{"name":"台湾","position":[25.03,121.3]},{"name":"北京","position":[39.92,116.46]},{"name":"上海","position":[31.22,121.48]},{"name":"重庆","position":[29.59,106.54]},{"name":"天津","position":[39.13,117.2]},{"name":"内蒙古","position":[40.82,111.65]},{"name":"广西","position":[22.84,108.33]},{"name":"西藏","position":[29.97,91.11]},{"name":"宁夏","position":[38.47,106.27]},{"name":"新疆","position":[43.77,87.68]},{"name":"香港","position":[22.28,114.17]},{"name":"澳门","position":[22.19,113.54]}];
    places.map(function (v) {
            BM.marker(v.position).bindPopup(function () {
                var city = v.name;
                var data1 = [];
                var data2 = [];
                for (var i = 0; i < 7; i++) {
                    var data = Math.random().toFixed(2);
                    data1.push(data);
                    data2.push(data * (Math.random() + 1.5));
                }
                chart.setOption({
                    title: {
                        text: city,
                        subtext: '数据纯属虚构',
                    },
                    series: [
                        {
                            name: '降雨量',
                            data: data1
                        },
                        {
                            name:'径流量',
                            data: data2
                        }
                    ]
                });
                return chart.getDom();
            },{maxWidth:600}).addTo(map);
        });
</script>
</body>
</html>