国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

vue中使用echarts制作圓環圖的實例代碼

2024-05-06 15:32:23
字體:
來源:轉載
供稿:網友

vue使用echarts制作圓環圖,代碼如下所示:

<div id="main"></div><script type="text/ecmascript-6"> export default {  //從父組件中接收到的數據  props:{   chartT:{    type:Object,    required:true   }  },  data () {   return {    charts: '',    totalIncome:'',    opinionData: [     {value: Math.abs(this.chartT.imp_rate)},//取絕對值     {value: 100}    ]   }  },  methods: {   drawPie (id) {    this.charts = this.$echarts.init(document.getElementById(id));    this.charts.setOption({     tooltip: {      trigger: 'item',      formatter: '{a}<br/>{b}:{c} (iwvjtn8m0%)'     },     legend: {      orient: 'vertical',      x: 'left',      data: this.opinion     },     color:['#2872ef','#d6d6d6','#fc6e51'],     series: [      {       name: '訪問來源',       type: 'pie',       radius: ['90%', '65%'],       avoidLabelOverlap: false,       label: {        normal: {         show: false,         position: 'center'        },        emphasis: {         show: true,         testStyle: {          fontSize: '30',          fontWeight: 'bold'         }        }       },       //根據數值判斷顏色//       itemStyle:{//        normal:{//         color:function(params){//          console.log(params)//          console.log(params.dataIndex)//          console.log(params.data.value)//          console.log(params.value)//          if(params.value > 0){//           return "#2872ef";//          }else if(params.value[0] < 0 ){//           return "#fc6e51";//          }//          return "#d6d6d6";//         }//        }//       },       labelLine: {        normal: {         show: false        }       },       data: this.opinionData      }     ]    })   }  },  mounted () {   this.$nextTick(function () {    this.drawPie('main')   })  }, }</script>

父組件傳值給子組件

<template>  <div class="index-wrapper">   <tittle :chartT="chart_tit"></tittle>  </div></template><script type="text/ecmascript-6"> import axios from 'axios' import Tittle from './applicationDetail/appTittle' export default {  data(){   return{    chart_tit:{}   }  }}</script>

總結

以上所述是小編給大家介紹的vue中使用echarts制作圓環圖的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對錯新站長站網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 中西区| 平武县| 都昌县| 禄劝| 民权县| 昭苏县| 广南县| 双柏县| 登封市| 军事| 大埔区| 盐亭县| 桑植县| 大田县| 无锡市| 永登县| 武平县| 府谷县| 沾化县| 琼中| 沙河市| 龙海市| 永德县| 万盛区| 上饶县| 易门县| 浏阳市| 瑞昌市| 武山县| 焉耆| 陆川县| 桂阳县| 尤溪县| 白河县| 顺平县| 广水市| 通许县| 巴彦淖尔市| 博白县| 陈巴尔虎旗| 玉田县|