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": {