echarts 在vue中的用法

<template> 
    <div class="box">
        <div class="box_head"> 
           预约系统数据统计图 
              <el-button type="primary" @click="switchover" style="position: absolute;right: 23px;top: 53px;">切换</el-button>
       </div>   
        <div class="box_center">
            <div class="box_center_1">
                <div class="box_left_1">
                   <div class="timehead">
                       <span class="box_left_1_title">预约总量(按月份显示)</span>     
                        <el-date-picker
                                class="timeData"
                                v-model="value4"
                                type="month"
                                placeholder="选择月">
                        </el-date-picker>
                   </div>
                   <div style="margin-top: 41px;">
                       <div  class='box_left_box_num'>
                           <div class='box_left_1_num'>
                               <span>百万</span>
                               <div>
                                    0
                               </div>
                           </div>
                           <div class='box_left_1_num1'>
                               <span>,</span>
                           </div>
                           <div class='box_left_1_num'>
                                <span>十万</span>
                                <div>
                                    0   
                               </div>
                           </div>
                           <div class='box_left_1_num'>
                                <span></span>
                                 <div>
                                     0 
                               </div>
                           </div>
                           <div class='box_left_1_num'>
                                <span></span>
                                <div>
                                     0   
                               </div>
                           </div>
                           <div class='box_left_1_num1'>
                                <span>,</span>
                           </div>
                           <div class='box_left_1_num'>
                                <span></span>
                                <div>
                                   0    
                               </div>
                           </div>
                           <div class='box_left_1_num'>
                                 <span></span>
                                <div>
                                   0    
                               </div>
                           </div>
                           <div class='box_left_1_num'>
                                 <span></span>
                                <div>
                                    0   
                               </div>
                            </div> 
                       </div>
                   </div>
                </div>   
                 <div class="box_left_2" >
                     <div class="box_left_box">
                         预约情况
                     </div> 
                     <div class="bgc"></div>  
                     <div class="bgc1"></div>
                     <div class="box_map" ref="sectorchart">
                         
                    </div>    
                </div> 
            </div>
            <div class="box_center_2"> 
                <div class="box_center_box">
                     <div class="box_center_box_1 box_center_box_2">
                         <div class="timehead box_postion">
                            <span class="box_left_1_title">机关三部(旅团分队)分布图</span>
                            <el-date-picker
                                    class="timeData"
                                    v-model="value4"
                                    type="month"
                                    placeholder="选择月">
                            </el-date-picker>
                        </div>
                        <div class="box_center_circle">
                            <div class="box_center_box_circle">
                                <div class="box_center_box_circle_1" ref="circlechart1">

                                </div>    
                                <div class="box_center_box_circle_2">
                                    <div class="box_center_num">280000</div> 
                                     <div class="box_center_text">机关C部</div>       
                                </div>    
                            </div>
                            <div class="box_center_box_circle">
                                <div class="box_center_box_circle_1" ref="circlechart2">

                                </div>    
                                <div class="box_center_box_circle_2">
                                      <div class="box_center_num">280000</div> 
                                     <div class="box_center_text">机关C部</div>                     
                                </div>      
                            </div>
                            <div class="box_center_box_circle">
                                <div class="box_center_box_circle_1" ref="circlechart3">

                                </div>    
                                <div class="box_center_box_circle_2">
                                     <div class="box_center_num">280000</div> 
                                     <div class="box_center_text">机关C部</div>            
                                </div>     
                            </div>
                        </div>
                    </div>   
                     <div class="box_center_box_1 box_center_box_2">
                        <div class="box_center_box_bottoom_1 ">
                            ◉ 机关三部(旅团分队)分布详情    
                        </div>
                        <div class="box_center_box_bottoom_2">
                             <div class="box_map" ref="storechart">

                            </div>
                        </div>
                    </div>  
               </div>    
            </div>
            <div class="box_center_3">
                <div class="box_right_1">
                    <div class="box_right_box"> 
                        进度图
                    </div>
                    <div class="box_map" ref="planchart">

                    </div>
                </div>   
                 <div class="box_right_2">
                     <div class="box_right_box">
                        文印完成动态数据  
                     </div>
                     <div>

                     </div>
                </div>    
            </div>
        </div>   
    </div>
</template>

<script>
import option from '../../common/option'
export default {
  components: {
    
  },
  data() {
    return {
        value4:null,
        //进度图
        mychart:null,
        planlist: [200,400,204],
        planx:['kkk','kkk','kkk'],
        //预约情况
        mychart1:null,
        //机关三部(旅团分队)分布详情
        mychart2:null,
        //机关三部分布
        mychart3:null,
        mychart4:null,
        mychart5:null,
    };
  },
  mounted() {
    this.draplan();
    this.drasector();
    this.drastore();
    this.dracircle1();
    this.dracircle2();
    this.dracircle3();
    let that = this;  
    window.onresize = () => {
      return (() => {
        that.mychart.resize();
        that.mychart1.resize();
        that.mychart2.resize();
        that.mychart3.resize();
         that.mychart4.resize();
        that.mychart5.resize();
      })()
    }
  },
  methods: {
    switchover(){
        this.$router.push('/exhibition1')
    },
    draplan() {
      let that = this
      that.mychart = that.$echarts.init(that.$refs.planchart)
      option.options2.series[1].itemStyle.normal.color = function(){
                  return new  that.$echarts.graphic.LinearGradient(
                                        0, 0, 1, 0,
                                        [
                                            {offset: 0, color: '#3977E6'},
                                            {offset: 1, color: '#37BBF8'}
                                        ])
                            // for(let i=0;i<that.planlist.length;i++){
                            //     if(that.planlist[i] <= 300){
                            //         return new  that.$echarts.graphic.LinearGradient(
                            //             0, 0, 1, 0,
                            //             [
                            //                 {offset: 0, color: '#3977E6'},
                            //                 {offset: 1, color: '#37BBF8'}
                            //             ])
                            //     }else{
                            //         return new that.$echarts.graphic.LinearGradient(
                            //             0, 0, 1, 0,
                            //             [
                            //                 {offset: 0, color: '#E8576C'},
                            //                 {offset: 1, color: '#661C5A'}

                            //             ])
                            //     }
                            // }
                        }
      option.options2.yAxis[0].data = that.planx
      option.options2.yAxis[1].data = that.planx
      option.options2.series[1].data = that.planlist
      that.mychart.setOption(option.options2)
    },
    drasector(){
      let that = this
      that.mychart1 = that.$echarts.init(that.$refs.sectorchart);
      that.mychart1.setOption(option.options1)
    },
    drastore(){
     let that = this
      that.mychart2 = that.$echarts.init(that.$refs.storechart);
      that.mychart2.setOption(option.options3)    
    },    
    dracircle1(){
     let that = this
      that.mychart3 = that.$echarts.init(that.$refs.circlechart1);
    //   option.options4.series[0].data[0].itemStyle.normal.color=function(){
    //                return new  that.$echarts.graphic.LinearGradient(
    //                                     0, 0, 1, 0,
    //                                     [
    //                                         {offset: 0, color: '#3977E6'},
    //                                         {offset: 1, color: '#37BBF8'}
    //                                     ])
    //             }
      that.mychart3.setOption(option.options4)    
    },    
    dracircle2(){
     let that = this
      that.mychart4 = that.$echarts.init(that.$refs.circlechart2);
      that.mychart4.setOption(option.options5)    
    },    
    dracircle3(){
     let that = this
      that.mychart5 = that.$echarts.init(that.$refs.circlechart3);
      that.mychart5.setOption(option.options6)    
    },    
  },

  created() {

  }
};
</script>


<style scoped="scoped" lang='less'>
.box{
    font-family: 'Arial Normal', 'Arial';
    font-weight: 400;
    font-style: normal;
    font-size: 13px;
    letter-spacing: normal;
    color: #fff;
    text-align: center;
    line-height: normal;
    text-transform: none;
    width: 100%;
    height: 100%;    
    padding: 10px;
    padding-top: 117px;
    padding-bottom: 25px;
    box-sizing: border-box; 
    background-color: rgba(8, 20, 36, 1);
    position: relative;
   .box_head{
       width: 100%;
       height: 122px;
       line-height: 100px;
       font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
        font-weight: 700;
        font-style: normal;
        font-size: 36px;
        color: #FFFFFF;
       position: absolute;
       top: 0px;
       background: url(~imgs/home/23.png) no-repeat center;
   }
   .box_center{
       height: 100%;
       .box_center_1{
        width:25%;
        height:100%;
        display: inline-block;
        box-sizing: border-box;
        padding-top:250px; 
        float:left;    
        position: relative;
        .box_left_1{
           height:250px;
           width: 100%; 
           position: absolute;
           top: 0px;
           padding: 8px 23px;
           box-sizing: border-box;
           background: url(~imgs/home/24.png) no-repeat;
           background-size: 100% 100%;
           .box_left_box_num{
               width: 302px;
               margin: 0 auto;
               margin-top: 20px;
               .box_left_1_num1,.box_left_1_num{
                    display: inline-block;
                    text-align: center;
                    margin-right: 5px;
                    height: 93px;
                    >div{
                     width: 34px;
                     height: 66px;  
                     background: url(~imgs/home/25.png) no-repeat;
                     background-size: 100% 100%;
                     font-size: 49px;
                    }
                }
                .box_left_1_num1{
                    height: 0px;
                    font-size: 24px;
                    span{
                          position: relative;
                          bottom: -16px;
                    }
                }

           }
        }
        .box_left_2{
           height:100%;
           width: 100%;
            background: url(~imgs/home/24.png) no-repeat;
           background-size: 100% 100%;
           padding: 10px 16px;
           box-sizing: border-box;
           position: relative;
           padding-top: 40px;  
           text-align: left;
            .box_left_box{
                    height: 30px;
                    font-size: 18px;
                    position: absolute;
                    top: 20px;
                }
            }
      
       }
      .box_center_2{
        width:50%;
        height:100%;
        display: inline-block; 
        box-sizing: border-box; 
        float: left;
        padding: 0px 10px;
        .box_center_box{
         width: 100%;
         height: 100%;
         background: url(~imgs/home/24.png) no-repeat;
         background-size: 100% 100%;
        padding: 22px 28px;
        box-sizing: border-box;
        .box_center_box_2{
              position: relative; 
              padding-top: 30px;
        }
        .box_postion{
            position: absolute;
            top: 0px;
            width: 100%;
        }
        .box_center_box_1{
             width: 100%;
             height: 50%; 
             box-sizing: border-box;  
             .box_center_circle{
                width: 100%;
                 height: 100%;
                 box-sizing: border-box;  
             .box_center_box_circle  {
                 width: 33.3%;
                 height: 100%;
                 display: inline-block;
                box-sizing: border-box;  
                .box_center_box_circle_1{
                    height: 70%; 
                    width: 100%;     
                }
                .box_center_box_circle_2{
                    height: 30%; 
                    width: 100%; 
                    .box_center_num{
                        font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
                        font-weight: 700;
                        font-style: normal;
                        font-size: 32px;
                        color: #FF6600;   
                    }
                    .box_center_text{
                        font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
                        font-weight: 700;
                        font-style: normal;
                        color: #FFFFFF;
                        font-size: 18px;
                    }
                }
             }    
             }
            
             .box_center_box_bottoom_1{
                 text-align: left;
                 font-size: 18px;
                 height: 30px;
                 position: absolute;
                 top: 0px;
             }
            .box_center_box_bottoom_2{
                 height:100%;
                 width: 100%; 
            }  
         }
        }
       }
       .box_center_3{
                width:25%;
                height:100%;
                display: inline-block;
                box-sizing: border-box;
                float:left;    
             .box_right_1{
                width: 100%;
                height:60%; 
                background: url(~imgs/home/24.png) no-repeat;
                background-size: 100% 100%;
                padding: 24px 13px;
                padding-top: 30px;
                position: relative;
                box-sizing: border-box;
             }   
             .box_right_2{
                width: 100%;
                height:40%; 
                background: url(~imgs/home/24.png) no-repeat;
                background-size: 100% 100%;
                padding-top: 30px;
                padding: 24px 13px;
                box-sizing: border-box;
                position: relative;
             }   
             .box_right_box{
                 height: 30px;
                 font-size: 18px;
                  position: absolute;
                  top: 10px;
              }
        }
   }
}

.box_map{
    width: 100%;
    height: 100%;
}
.timehead{
    height: 40px;
    line-height: 40px;
    text-align: left;
  .box_left_1_title{
    font-size: 18px;
}

.btn{
    position: absolute;
    right: 1px;
}

.timeData{
    display: inline-block;
    width: 0px;
    float: right;
    margin-right: 40px;
    /deep/.el-input__inner{
        padding-left:0px !important;
        background-color: rgba(8, 20, 36, 0.1);
        border: none !important;
    }
    /deep/ .el-input__icon{
        color: #fff;
        font-size: 20px;
    }
}
}

.bgc1{
    width: 200px;
    height: 200px;
    border-radius: 260px;
     background: url(~imgs/home/28.png) no-repeat;
    background-size: 100% 100%;
    position: absolute;
    left: 50%;
    top: 40%; 
     margin-left: -100px;
    margin-top: -80px;
    animation: rotate 20s linear infinite;
}

.bgc{
    width: 260px;
    height: 260px;
    border-radius: 260px;
     background: url(~imgs/home/27.png) no-repeat;
    background-size: 100% 100%;
    position: absolute;
    left: 50%;
    top: 40%; 
    margin-left: -130px;
    margin-top: -108px;
    animation: rotate1 20s linear infinite;
}

@keyframes rotate1 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes rotate1 {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值