vue 项目中引入echarts并实现环形图

本文介绍了如何在Vue项目中引入Echarts库并创建环形图,包括安装Echarts,注册组件,以及在组件中使用Echarts的步骤。同时强调了环形图内外圈颜色对应的重要性,并提到数据处理的注意事项。
摘要由CSDN通过智能技术生成

1、安装命令:npm install echarts -S

2、在main.js中引入,

  • import ECharts from 'vue-echarts/components/ECharts'
  • import 'echarts/lib/chart/pie'
  • import 'echarts/lib/component/tooltip'
  • Vue.component('v-chart', ECharts)

3、在组件中使用

<template>
  <div >
    <div style="width: 100%;height: 400px;" id="container"></div>
  </div>
</template>
<script>
export default {
    name: "circleCharts",
    data() {
      return {
        dataList:[
        {
            "value": 4830,
            "name": "etiology",
            "itemStyle": {
                "color": "rgb(125,230,190)"
            }
        },
        {
            "value": 3819,
            "name": "physiopathology",
            "itemStyle": {
                "color": "rgb(109,204,167)"
            }
        },
        {
            "value": 955,
            "name": "epidemiology",
            "itemStyle": {
                "color": "rgb(87,187,149)"
            }
        },
        {
            "value": 6548,
            "name": "drug therapy",
            "itemStyle": {
                "color": "rgb(52,146,160)"
            }
        },
        {
            "value": 4531,
            "name": "other therapy",
            "itemStyle": {
                "color": "rgb(91,187,202)"
            }
        },
        {
            "value": 1438,
            "name": "non drug therapy",
            "itemStyle": {
            
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值