vue echarts 饼形图

<style>
  @import "../../css/style.css";
</style>
<style scoped>
  @import "../../css/vue_half_pie.css";
</style>
<template>

    <div class="half_pie">
      <chart class="pie"  :options="half_pie"></chart>
      <div class="halfBtn">
        <button @click="RoseType">Rose Type</button>
        <button @click="LineChart">Line Chart</button>
      </div>
    </div>

</template>



<script>
  import eCharts from 'vue-echarts/components/ECharts'
    export default {
        data() {
            return {
              style: {}
            }
        },
      created() {

        this.style = {
          normal: {
            label: {
              show: false,
            },
            labelLine: {
              show: false
            },
            color: 'rgba(0,0,0,0)',
            borderWidth: 0
          },
          emphasis: {
            color: 'rgba(0,0,0,0)',
            borderWidth: 0
          }

        };
      },
      methods:{
        RoseType(){
          this.$router.push({path:'/rose_pie'})
        },
        LineChart(){
            this.$router.push({path:'/single_line'})
        }
      },

      computed:{

        half_pie(){
          return{
            backgroundColor: '#B5C3BD',
            tooltip : {
              show: true,
              formatter: "{b} : {c}"
            },

            legend: {
              top: "8%",
              x: 'left',
              left: "4%",
              itemWidth:30,
              itemHeight:20,
              data: ['霸王龙','三角龙','弯龙' ,'剑龙'],
              textStyle: {
                color: '#fff',
                align:'left',
                x: 'left',
                textAlign:'top'
              },
              orient: "horizontal",

            },
            grid: {
              right:'0%',
              top: '5%',
              left: '0%',
              bottom: '0%',
              containLabel: false,
            },
            series: [
              {
                name: '霸王龙',
                type: 'pie',
                radius: ['65%', '75%'],
                itemStyle: {
                  normal:{
                    color: '#8936F8'
                  }
                },
                data:
                  [
                  {
                  value: 7645434,
                  name: '霸王龙'
                }, {
                  value: 3612343,
                  name: '总数',
                  tooltip: {
                    show: false
                  },
                  itemStyle:  this.style
                }

                ]
              }, {
                name: '三角龙',
                type: 'pie',
                clockWise: true,
                radius: ['50%', '60%'],
                itemStyle: {
                  normal:{
                    color: '#9957F1'
                  }

                },
                data: [{
                  value: 2632321,
                  name: '三角龙'
                }, {
                  value: 2212343,
                  name: '总数',
                  tooltip: {
                    show: false
                  },
                  itemStyle:  this.style
                }]
              }, {
                name: '弯龙',
                type: 'pie',
                radius: ['35%', '45%'],
                itemStyle: {
                  normal:{
                    color: '#C4A2F3'
                  }

                },

                data: [{
                  value: 1823323,
                  name: '弯龙'
                }, {
                  value: 1812343,
                  name: '总数',
                  tooltip: {
                    show: false
                  },
                  itemStyle:  this.style
                }]
              },
              {
                name: '剑龙',
                type: 'pie',
                clockWise: true,

                radius: ['20%', '30%'],
                itemStyle: {
                  normal:{
                    color: '#E2D6F3'
                  }

                },
                data: [ {
                  value: 1342221,
                  name: '剑龙'
                },{
                  value:1912343,
                  name: '总数',
                  tooltip: {
                    show: false
                  },
                  itemStyle:  this.style
                }

                ]
              }
            ]
          };
        }

      }
    }

</script>


在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值