【echarts】地图实现省市区联动

地图选择器:http://datav.aliyun.com/tools/atlas/#&lat=31.728167146023935&lng=104.32617187499999&zoom=3

效果如下:

代码如下:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/public.css">
    <link rel="stylesheet" href="css/index.css">
    

    <title>看板</title>
  </head>
  <body> 
    <div class="container-fluid">

      <header>
        <div class="header_fl"></div>
        <div class="header_middle">尤顺智动环境监测云平台</div>
        <div class="header_fr" id="currentDate"></div>
      </header>

      <!-- main -->
      <div class="mainBox">
        <div class="row">

          <div class="col-md-3">
            <div class="provinceBox mapLine">
              <div class="province_title">省图(直辖市图)</div>
              <div id="province" class="province_map"></div>
            </div>
            
          </div>

          <div class="col-md-4 ">
            <!-- <div class="province_title">省图(直辖市图)</div> -->
            <div id="china" class="china_map"></div>
          </div>

          <div class="col-md-5 ">
            <div class="airBox mapLine">
              <div class="province_title">空气指数趋势图</div>
              <div id="air" style="width: 100%; height:300px;"></div>
            </div>
            
          </div>

        </div>

        <div class="row">
          <div class="col-md-3  ">
            <div class="provinceBox mapLine">
              <div class="province_title">市/区 亮点图</div>
              <div id="area" class="province_map"></div>
            </div>
            

          </div>
          <div class="col-md-9 ">
            <div class="row">
              <div class="col-md-4  ">
                <div class="customer_number mapLine" >
                  <div class="province_title">客户数量</div>
                  <div id="customer_scroll" class="scroll"> 
                    <ul class="progressBar">
                      <li>
                        <div class="pro_left">黄浦区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">徐汇区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">长宁区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">静安区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">普陀区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">虹口区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">杨浦区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">浦东新区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">闵行区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">宝山区</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
  
                    </ul>
                  </div>
                </div>
              </div>

              <div class="col-md-4">
                <div class="customer_number mapLine" >
                  <div class="province_title">产品信息综合展示</div>
                  <div id="scroll" class="scroll">
                    <ul class="progressBar">
                      <li>
                        <div class="pro_left">产品类型1</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型2</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型3</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型4</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型5</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型6</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型7</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型8</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型9</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型10</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                      <li>
                        <div class="pro_left">产品类型11</div>
                        <div class="pro_middle">
                          <div class="progress-bar">
                            <div class="bar has-rotation has-colors red heat-gradient" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
                              <div class="bar-face face-position back percentage"></div>
                            </div>
                          </div>
                        </div>
                        <div class="pro_right">1212</div>
                      </li>
                    </ul>
                  </div>
                  
                </div>
                
              </div>

              <div class="col-md-4">
                <div class="customer_number mapLine">
                  <div class="province_title">客户信息综合展示</div>
                  <div id="customer_info" class="province_map"></div>
                </div>
                
              </div>


            </div>
          </div>
         
        </div>
      </div>
      <!-- main end-->


    </div>

    
    

    
    
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/echarts.min.js"></script>
    <script src="js/china.js"></script>
    <script src="js/public.js"></script>
    <script>
      $('#currentDate').html(currentDate())
      console.log(currentDate(),'currentDate')
      
      /*
        客户数量  - 滚动
      */
      scroll_customer(); 
      function scroll_customer(){
        var scrollIndex = 0;
        var Timer = null;
        clearInterval(Timer);
          var ul = $("#customer_scroll ul");
          var li = ul.children("li");
          var h = li.height();
          var index = 0;
          ul.css("height",h*li.length*2);
          ul.html(ul.html()+ul.html());  //复制一份当前ul内容 
            function run(){
              if(scrollIndex>=li.length){
              ul.css({top:0});
              scrollIndex = 1;
              ul.animate({top:-scrollIndex*h},200);
            } 
            else{
              scrollIndex++; 
              ul.animate({top:-scrollIndex*h},200);
            }
          }
        Timer= setInterval(run,3000); 
      };

      
      /*
        产品信息综合展示  - 滚动
      */
      scroll_f();
      function scroll_f(){
        var scrollIndex = 0;
        var Timer = null;
        clearInterval(Timer);
          var ul = $("#scroll ul");
          var li = ul.children("li");
          var h = li.height();
          var index = 0;
          ul.css("height",h*li.length*2);
          ul.html(ul.html()+ul.html());  //复制一份当前ul内容 
            function run(){
              if(scrollIndex>=li.length){
              ul.css({top:0});
              scrollIndex = 1;
              ul.animate({top:-scrollIndex*h},200);
            } 
            else{
              scrollIndex++; 
              ul.animate({top:-scrollIndex*h},200);
            }
          }
        Timer= setInterval(run,3000); 
      }
       

      // 全国
      nationwide()
      function nationwide(){
        $.get('https://geo.datav.aliyun.com/areas_v2/bound/100000_full.json',function (chinaJson) {
            echarts.registerMap('china', chinaJson);
            var arr = []
            $.each(chinaJson.features, function(index, item){
              arr.push({
                name: item.properties.name,
                adcode: item.properties.adcode,
              })
            })
            // 绘制图表,准备数据
        var option = {
          tooltip: {
            show: true,
            formatter: function (params) {
              // console.log(params)
                var info = '<p style="font-size:12px">' + params.name + '</p>'
                // <p style="font-size:14px">这里可以写一些,想展示在页面上的别的信息</p>'
                return info;
            },
            // backgroundColor: "#ff7f50",//提示标签背景颜色
            // textStyle: { color: "#fff" } //提示标签字体颜色
  
          },
          series: [
            {
              name: '中国',
              type: 'map',
              map: 'china',
              mapType: 'china',
              // selectedMode: 'multiple',
              nameProperty: 'adcode',
              zoom: 1, //当前视角的缩放比例
              roam: true, //是否开启平游或缩放
              scaleLimit: { //滚轮缩放的极限控制
                min: 1,
                max: 2
              },

              label: {
                  normal: {
                      show: true,//显示省份标签
                      textStyle:{color:"#fff"}//省份标签字体颜色
                  },
                  emphasis: {
                      show: true,//对应的鼠标悬浮效果
                      textStyle:{color:"#fff"}
                  },
                  // formatter: '{b}: {@score}'
              },
              itemStyle: {
                  normal: {
                    label:{
                      show:false, // 显示省份名称
                    },
                    borderWidth: 1,//区域边框宽度
                    borderColor: '#00A0E8',//区域边框颜色
                    areaColor:"#121D39",//区域颜色
                  },
                  emphasis: { // 选中部分
                    
                    borderWidth: .5,
                    borderColor: '#4b0082',
                    areaColor: "#00A0E8",
                    textStyle:{color:"#fff"}
                  }
              },
              data: arr
            }
          ]
        };

        var myChart = echarts.init(document.getElementById('china'));
            myChart.setOption(option);

            myChart.off('click')
            myChart.on('click', function (params) {
              console.log(params);
              testprovince(params.data.adcode)
              
            })
        });
      };

      /*
        省
      */
      function testprovince(adcode) {
        $.get('https://geo.datav.aliyun.com/areas_v2/bound/'+adcode+'_full.json',function (geoJson) {
          echarts.registerMap('province', geoJson);
          var arr = []
          $.each(geoJson.features, function(index, item){
            arr.push({
              name: item.properties.name,
              adcode: item.properties.adcode,
              level: item.properties.level,
            })
          });
          var option = {
            tooltip: {
              formatter: function (params) {
                  var info = '<p style="font-size:12px">' + params.name + '</p>'
                  // <p style="font-size:14px">这里可以写一些,想展示在页面上的别的信息</p>'
                  return info;
              },
              // backgroundColor: "#ff7f50",//提示标签背景颜色
              // textStyle: { color: "#fff" } //提示标签字体颜色
            },
            series: [
              {
                name: '省',
                type: 'map',
                mapType: 'province',
                selectedMode: 'multiple',
                label: {
                    normal: {
                        show: true,//显示省份标签
                        textStyle:{color:"#fff"}//省份标签字体颜色
                    },
                    emphasis: {
                        show: true,//对应的鼠标悬浮效果
                        textStyle:{color:"#fff"}
                    }
                },
                itemStyle: {
                    normal: {
                      label:{
                        show:false, // 显示省份名称
                      },
                      borderWidth: 1,//区域边框宽度
                      borderColor: '#00A0E8',//区域边框颜色
                      areaColor:"#121D39",//区域颜色
                    },
                    emphasis: { // 选中部分
                      
                      borderWidth: .5,
                      borderColor: '#4b0082',
                      areaColor: "#00A0E8",
                      textStyle:{color:"#fff"}
                    }
                },
                data: arr
              }
            ]
          };

          var myChart = echarts.init(document.getElementById('province'));
          myChart.setOption(option);
          // 地图点击事件
          myChart.off('click')
          myChart.on('click',function(params){
            console.log(params)
            if (params.data.level != 'district') {
              city(params.data.adcode)
            }
            
          })
        })
      };
      
      /*
        市
      */
      function city(adcode) {
        $.get('https://geo.datav.aliyun.com/areas_v2/bound/'+adcode+'_full.json',function (geoJson) {
          echarts.registerMap('area', geoJson);
            var arr = []
            $.each(geoJson.features, function(index, item){
              arr.push({
                name: item.properties.name,
                adcode: item.properties.adcode,
              })
            })
          var option = {
          tooltip: {
            formatter: function (params) {
                var info = '<p style="font-size:12px">' + params.name + '</p>'
                // <p style="font-size:14px">这里可以写一些,想展示在页面上的别的信息</p>'
                return info;
            },
            // backgroundColor: "#ff7f50",//提示标签背景颜色
            // textStyle: { color: "#fff" } //提示标签字体颜色
          },
          series: [
            {
              name: '市',
              type: 'map',
              mapType: 'area',
              selectedMode: 'multiple',
              label: {
                  normal: {
                      show: true,//显示省份标签
                      textStyle:{color:"#fff"}//省份标签字体颜色
                  },
                  emphasis: {
                      show: true,//对应的鼠标悬浮效果
                      textStyle:{color:"#fff"}
                  }
              },
              itemStyle: {
                  normal: {
                    label:{
                      show:false, // 显示省份名称
                    },
                    borderWidth: 1,//区域边框宽度
                    borderColor: '#00A0E8',//区域边框颜色
                    areaColor:"#121D39",//区域颜色
                  },
                  emphasis: { // 选中部分
                    
                    borderWidth: .5,
                    borderColor: '#4b0082',
                    areaColor: "#00A0E8",
                    textStyle:{color:"#fff"}
                  }
              },
              data: arr
            }
          ]
        };

        var myChart = echarts.init(document.getElementById('area'));
        myChart.setOption(option);
        })
      };


      

      /*
        空气指数趋势
      */
      air();
      function air(){
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('air'));
        option = {
          title: {
              text: ''
          },
          tooltip: {
              trigger: 'axis',
              axisPointer: {
                  type: 'cross',
                  label: {
                      backgroundColor: '#6a7985'
                  }
              }
          },
          legend: {
            left:'left',
            textStyle: {
              color: '#fff',
              fontSize: 12
            },
              data: [
                'O3标准值', 'O3均值', 'RPM10标准值', 'RPM10均值', 
                'RPM2.5标准值', 'RPM2.5均值','CO标准值', 'CO均值',
                'NO2标准值', 'NO2均值','SO2标准值', 'SO2均值',
              ],
              icon:'circle', // 改变图标形状
          },
          toolbox: {
              feature: {
                  saveAsImage: {}
              }
          },
          grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
          },
          xAxis: [
            {
              type: 'category',
              boundaryGap: false,
              data: ['0', '6', '12', '18', '24',],
              axisLine:{
                lineStyle:{
                  type:'solid',
                  color: '#3E7798',//左边线的颜色
                  width:'2'//坐标线的宽度
                }
              },
              splitLine: {
                  show: true, // 网格线是否显示
                  lineStyle:{
                    color: '#3E7798',
                    width: 1,
                    type: 'solid'
                }
            }
            }
          ],
          yAxis: [
              {
                  type: 'value',
                  axisLine:{
                    lineStyle:{
                      type:'solid',
                      color: '#3E7798',//左边线的颜色
                      width:'2'//坐标线的宽度
                    },
                },
                splitLine: {
                  show: true, // 网格线是否显示
                  lineStyle:{
                    color: '#3E7798',
                    width: 1,
                    type: 'solid'
                  }
              }
              }
          ],
          series: [
            
              {
                  name: 'O3标准值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [120, 132, 101, 134, 90],
                  itemStyle:{
                    normal:{
                      color:'#35C6FF', // 拆线点的颜色
                      lineStyle:{
                        color:'#35C6FF', // 折线颜色
                      }
                    }
                  },
                  // areaStyle:{
                  //   normal:{color:'#35C6FF'}
                  // }
              },
              {
                  name: 'O3均值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [220, 182, 191, 234, 290],
                  itemStyle:{
                    normal:{
                      color:'#2D6AFC', // 拆线点的颜色
                      lineStyle:{
                        color:'#2D6AFC', // 折线颜色
                      }
                    }
                  },
                  // areaStyle:{
                  //   normal:{color:'#2D6AFC'}
                  // }
              },
              {
                  name: 'RPM10标准值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [150, 232, 201, 154, 190],
                  itemStyle:{
                    normal:{
                      color:'#8976FE', // 拆线点的颜色
                      lineStyle:{
                        color:'#8976FE', // 折线颜色
                      }
                    }
                  },
              },
              {
                name: 'RPM10均值',
                type: 'line',
                stack: '总量',
                areaStyle: {},
                data: [320, 332, 301, 334, 390],
                itemStyle:{
                  normal:{
                    color:'#BD00FF', // 拆线点的颜色
                    lineStyle:{
                      color:'#BD00FF', // 折线颜色
                    }
                  }
                },
              },
              {
                  name: 'RPM2.5标准值',
                  type: 'line',
                  stack: '总量',
                  label: {
                      normal: {
                          show: true,
                          position: 'top'
                      }
                  },
                  areaStyle: {},
                  data: [820, 932, 901, 934, 1290],
                  itemStyle:{
                    normal:{
                      color:'#FFDA65', // 拆线点的颜色
                      lineStyle:{
                        color:'#FFDA65', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'RPM2.5均值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [820, 932, 901, 934, 1290],
                  itemStyle:{
                    normal:{
                      color:'#FF7926', // 拆线点的颜色
                      lineStyle:{
                        color:'#FF7926', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'CO标准值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [820, 932, 901, 934, 1290],
                  itemStyle:{
                    normal:{
                      color:'#C7FF36', // 拆线点的颜色
                      lineStyle:{
                        color:'#C7FF36', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'CO均值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [820, 932, 901, 934, 1290],
                  itemStyle:{
                    normal:{
                      color:'#00FF51', // 拆线点的颜色
                      lineStyle:{
                        color:'#00FF51', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'NO2标准值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [870, 932, 701, 734, 1790],
                  itemStyle:{
                    normal:{
                      color:'#FF8FBC', // 拆线点的颜色
                      lineStyle:{
                        color:'#FF8FBC', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'NO2均值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [920, 992, 991, 994, 1990],
                  itemStyle:{
                    normal:{
                      color:'#FF1400', // 拆线点的颜色
                      lineStyle:{
                        color:'#FF1400', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'SO2标准值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [820, 832, 801, 834, 1890],
                  itemStyle:{
                    normal:{
                      color:'#00E289', // 拆线点的颜色
                      lineStyle:{
                        color:'#00E289', // 折线颜色
                      }
                    }
                  },
              },
              {
                  name: 'SO2均值',
                  type: 'line',
                  stack: '总量',
                  areaStyle: {},
                  data: [620, 632, 601, 634, 1690],
                  itemStyle:{
                    normal:{
                      color:'#00EADA', // 拆线点的颜色
                      lineStyle:{
                        color:'#00EADA', // 折线颜色
                      }
                    }
                  },
              },
          ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
      }; 

      /*
        客户数量
      */
      
      /*
        客户信息
      */
      customerInfo()
      function customerInfo(){
        var myChart = echarts.init(document.getElementById('customer_info'));
        option = {
          title: {
            text: '',
            subtext: '',
            left: 'center'
          },
          tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)'
          },
          legend: {
            // orient: 'vertical',
            // top: 'middle',
            textStyle: { //图例文字的样式
              color: '#fff',
              fontSize: 12
            },
            bottom: 10,
            left: 'center',
            data: [
                '半导体', '政府大楼', '学校', '医药食品', 
                '医院', '地铁', '机场火车站', '住宅'
                ]
          },
          color:[
          '#FF9854','#FFE500','#00EACB','#00EACB',
          '#01B3FF','#2140DC','#7E30FF','#CC4DFE','#F33732'
          ],
          series: [
            {
              type: 'pie',
              radius: ['50%','70%'],
              center: ['50%', '50%'],
              selectedMode: 'single',
              data: [
                {value: 535, name: '半导体'},
                {value: 510, name: '政府大楼'},
                {value: 634, name: '学校'},
                {value: 735, name: '医药食品'},
                {value: 735, name: '医院'},
                {value: 735, name: '地铁'},
                {value: 735, name: '机场火车站'},
                {value: 735, name: '住宅'},
              ],
              
              
            }
          ]
        };
        myChart.setOption(option)
      }

    </script>
  </body>
</html>

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值