首页 > 其他 > 详细

水球图

时间:2021-04-15 01:14:44      阅读:38      评论:0      收藏:0      [点我收藏+]
 
技术分享图片

 

 

 
<template>

  <div class="map-view">
      <div class="left">
        <BMapScatter />
      </div>

      <div class="right">
          <el-card shadow="hover">
            <template v-slot:header>
              <div class="title">用户月同比增长</div>  
            </template> 

              <template  >
              <div class="chart-wrapper">
                
                      <ve-liquidfill :data="chartData" height="100%" :settings="chartSettings"/>  
                  <!--   <div id="container">
                  </div> -->
              </div>  
            </template>  
          </el-card>

            <el-card shadow="hover">
            <template v-slot:header>
              <div class="title">热门搜索</div> 
            </template> 

              <template>
              <div class="chart-wrapper">222</div>  
            </template>  
          </el-card>

      </div>

  </div>

</template>

<script> 
    import ‘echarts-liquidfill‘ 
    // import liquidFill from  ‘../liquidFill‘  
    import BMapScatter from ‘../BMapScatter‘

    function getColor(value){
      return  value > 0 && value <= 0.5 ? ‘rgba(97,216,0,.7)‘ :
              value > 0.5 && value <= 0.8 ? ‘rgba(204,178,26,.7)‘ : 
              value > 0.8 ?   ‘rgba(241,47,28,.7)‘ : ‘#c7c7cb‘;
    }

    export default {
      data(){
        return {
          chartData:{
            columns:[‘city‘,‘percent‘],
            rows:[{
              city:‘rate‘,
              percent: 0.5988
            }]
          },
         chartSettings:{}
        }
      },
       components:{
          BMapScatter 
       },
      mounted() {
        this.chartSettings = {
          seriesMap:{
              ‘rate‘:{
                radius: ‘80%‘,
                label:{ 
                  formatter:(v)=>{ 
                    return `${Math.floor(v.data.value * 100)}%`
                  },
                  textStyle:{
                    fontSize:36,
                    color:‘#999‘,
                    fontWeight:‘normal‘
                  },
                  position:[‘50%‘,‘50%‘],
                  insideColor:‘#fff‘
                },
                outline:{
                  itemStyle:{
                    borderColor:‘#aaa4a4‘,
                    borderWidth:1,
                    color: ‘none‘,
                    shadowBlur:0,
                    shadowColor:‘#fff‘
                  },
                  borderDistance: 0
                },
                backgroundStyle:{
                  color:‘#fff‘
                },
                itemStyle:{
                  shadowBlur:0,
                  shadowColor:‘#fff‘
                },
                amplitude: 8,
                color: [getColor(this.chartData.rows[0].percent)]
              }
            }
        }
      },

      //  mounted(){
      //  //  const data = [0.68,0.5,0.4];
      //   const chart = this.$echarts.init(document.getElementById(‘container‘));
      //   chart.setOption({
      //     series:[{
      //       type:‘liquidFill‘,
      //       data:[0.68,0.5,0.4],
      //       color:[‘red‘,‘blue‘,‘yellow‘],
      //       waveAnimation:false,
      //       itemStyle:{
      //         opacity: 0.6
      //       },
      //       emphasis:{
      //         itemStyle:{
      //            opacity: 0.9
      //         }
      //       },
      //       amplitude:10,
      //       backgroundStyle:{
      //         color:‘purple‘,
      //         borderWidth: 4,
      //         borderColor:‘#333‘
      //       },
      //       outLine:{
      //         show:true,
      //         borderDistance:2,
      //         itemStyle:{
      //            borderWidth: 2,
      //            borderColor:‘red‘,
      //            shadowBlur:‘none‘
      //         }
      //       },
      //       shape:‘react‘
      //     }]
      //   })
      //  }
    } 
</script>

<style lang="scss" scoped>

#container{
  width:160px;
  height: 160px;
}
.map-view{
  display: flex;
  margin-top: 20px;
  .left{
    flex: 0 0 80%;
    width: 80%;
    height: 600px;
    background: #fff;
  }
  .right{
    flex: 1;
    display: flex;
    flex-direction: column; 
    justify-content: space-between;
    margin-left: 20px;
    .title{
        display:flex;
        align-items: center;
        height: 60px;
        box-sizing: border-box;
        border-bottom: 1px solid #eee;
        font-size: 14px;
        font-weight: bold;
        padding: 0 0 0 20px;
    }
    .chart-wrapper{
      width: 100%;
      height: 190px;
    }

  }
}
</style>

水球图

原文:https://www.cnblogs.com/eric-share/p/14660119.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!