<div id="myChart" :style="{width: '600px', height: '300px'}"></div>
drawLine(){
let dd = {
title: [
{
text: '山东覅金额偶滴就OK的房间哦',
subtext: '纯属虚构',
left: '0%'
},
{
text: '同名数量统计',
subtext: '纯属虚构',
left: '60%'
}
],
series: [
{
name: '访问来源',
type: 'pie',
radius: ['10%', '20%',],
center : [ '20%', '50%' ],//位置确定:左下角
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{name: 'A', value: 1212},
{name: 'B', value: 2323},
{name: 'C', value: 1919}
]
},
{
// name: '访问来源',
type: 'pie',
radius: ['50%', '80%'],
center : [ '70%', '50%' ],//位置确定:左下角
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{name: 'l', value: 1212},
{name: 'g', value: 2323},
{name: 'h', value: 1919}
]
},
]
};
**
## 这是在vue中使用echarts 安装echarts依赖
**
或者使用淘宝的镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install echarts -S
**
## 创建图表
**
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
首先需要全局引入
在main.js中
// 引入echarts
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
这是一个页面有了两个图
radius: ['10%', '20%']:两个值可以控制圆环的大小和粗细
center : [ '20%', '50%' ],控制图标的位置也可以用具体值表示
刚使用做个笔记