|
@ -1,5 +1,5 @@ |
|
|
<template> |
|
|
<template> |
|
|
<section class="chart"> |
|
|
|
|
|
|
|
|
<section class="chart-container"> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<div id="chartColumn" style="width:100%; height:400px;"></div> |
|
|
<div id="chartColumn" style="width:100%; height:400px;"></div> |
|
@ -23,17 +23,17 @@ |
|
|
<script> |
|
|
<script> |
|
|
import echarts from 'echarts' |
|
|
import echarts from 'echarts' |
|
|
|
|
|
|
|
|
export default{ |
|
|
|
|
|
data (){ |
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
chartColumn:null, |
|
|
|
|
|
chartBar:null, |
|
|
|
|
|
chartLine:null, |
|
|
|
|
|
chartPie:null |
|
|
|
|
|
|
|
|
chartColumn: null, |
|
|
|
|
|
chartBar: null, |
|
|
|
|
|
chartLine: null, |
|
|
|
|
|
chartPie: null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted:function(){ |
|
|
|
|
|
var _this=this; |
|
|
|
|
|
|
|
|
mounted: function () { |
|
|
|
|
|
var _this = this; |
|
|
//基于准备好的dom,初始化echarts实例 |
|
|
//基于准备好的dom,初始化echarts实例 |
|
|
this.chartColumn = echarts.init(document.getElementById('chartColumn')); |
|
|
this.chartColumn = echarts.init(document.getElementById('chartColumn')); |
|
|
this.chartBar = echarts.init(document.getElementById('chartBar')); |
|
|
this.chartBar = echarts.init(document.getElementById('chartBar')); |
|
@ -44,7 +44,7 @@ |
|
|
title: { text: 'Column Chart' }, |
|
|
title: { text: 'Column Chart' }, |
|
|
tooltip: {}, |
|
|
tooltip: {}, |
|
|
xAxis: { |
|
|
xAxis: { |
|
|
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] |
|
|
|
|
|
|
|
|
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] |
|
|
}, |
|
|
}, |
|
|
yAxis: {}, |
|
|
yAxis: {}, |
|
|
series: [{ |
|
|
series: [{ |
|
@ -80,7 +80,7 @@ |
|
|
}, |
|
|
}, |
|
|
yAxis: { |
|
|
yAxis: { |
|
|
type: 'category', |
|
|
type: 'category', |
|
|
data: ['巴西','印尼','美国','印度','中国','世界人口(万)'] |
|
|
|
|
|
|
|
|
data: ['巴西', '印尼', '美国', '印度', '中国', '世界人口(万)'] |
|
|
}, |
|
|
}, |
|
|
series: [ |
|
|
series: [ |
|
|
{ |
|
|
{ |
|
@ -104,7 +104,7 @@ |
|
|
trigger: 'axis' |
|
|
trigger: 'axis' |
|
|
}, |
|
|
}, |
|
|
legend: { |
|
|
legend: { |
|
|
data:['邮件营销','联盟广告','搜索引擎'] |
|
|
|
|
|
|
|
|
data: ['邮件营销', '联盟广告', '搜索引擎'] |
|
|
}, |
|
|
}, |
|
|
grid: { |
|
|
grid: { |
|
|
left: '3%', |
|
|
left: '3%', |
|
@ -115,60 +115,60 @@ |
|
|
xAxis: { |
|
|
xAxis: { |
|
|
type: 'category', |
|
|
type: 'category', |
|
|
boundaryGap: false, |
|
|
boundaryGap: false, |
|
|
data: ['周一','周二','周三','周四','周五','周六','周日'] |
|
|
|
|
|
|
|
|
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] |
|
|
}, |
|
|
}, |
|
|
yAxis: { |
|
|
yAxis: { |
|
|
type: 'value' |
|
|
type: 'value' |
|
|
}, |
|
|
}, |
|
|
series: [ |
|
|
series: [ |
|
|
{ |
|
|
{ |
|
|
name:'邮件营销', |
|
|
|
|
|
type:'line', |
|
|
|
|
|
|
|
|
name: '邮件营销', |
|
|
|
|
|
type: 'line', |
|
|
stack: '总量', |
|
|
stack: '总量', |
|
|
data:[120, 132, 101, 134, 90, 230, 210] |
|
|
|
|
|
|
|
|
data: [120, 132, 101, 134, 90, 230, 210] |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
name:'联盟广告', |
|
|
|
|
|
type:'line', |
|
|
|
|
|
|
|
|
name: '联盟广告', |
|
|
|
|
|
type: 'line', |
|
|
stack: '总量', |
|
|
stack: '总量', |
|
|
data:[220, 182, 191, 234, 290, 330, 310] |
|
|
|
|
|
|
|
|
data: [220, 182, 191, 234, 290, 330, 310] |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
name:'搜索引擎', |
|
|
|
|
|
type:'line', |
|
|
|
|
|
|
|
|
name: '搜索引擎', |
|
|
|
|
|
type: 'line', |
|
|
stack: '总量', |
|
|
stack: '总量', |
|
|
data:[820, 932, 901, 934, 1290, 1330, 1320] |
|
|
|
|
|
|
|
|
data: [820, 932, 901, 934, 1290, 1330, 1320] |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.chartPie.setOption({ |
|
|
this.chartPie.setOption({ |
|
|
title : { |
|
|
|
|
|
|
|
|
title: { |
|
|
text: 'Pie Chart', |
|
|
text: 'Pie Chart', |
|
|
subtext: '纯属虚构', |
|
|
subtext: '纯属虚构', |
|
|
x:'center' |
|
|
|
|
|
|
|
|
x: 'center' |
|
|
}, |
|
|
}, |
|
|
tooltip : { |
|
|
|
|
|
|
|
|
tooltip: { |
|
|
trigger: 'item', |
|
|
trigger: 'item', |
|
|
formatter: "{a} <br/>{b} : {c} ({d}%)" |
|
|
formatter: "{a} <br/>{b} : {c} ({d}%)" |
|
|
}, |
|
|
}, |
|
|
legend: { |
|
|
legend: { |
|
|
orient: 'vertical', |
|
|
orient: 'vertical', |
|
|
left: 'left', |
|
|
left: 'left', |
|
|
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎'] |
|
|
|
|
|
|
|
|
data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'] |
|
|
}, |
|
|
}, |
|
|
series : [ |
|
|
|
|
|
|
|
|
series: [ |
|
|
{ |
|
|
{ |
|
|
name: '访问来源', |
|
|
name: '访问来源', |
|
|
type: 'pie', |
|
|
type: 'pie', |
|
|
radius : '55%', |
|
|
|
|
|
|
|
|
radius: '55%', |
|
|
center: ['50%', '60%'], |
|
|
center: ['50%', '60%'], |
|
|
data:[ |
|
|
|
|
|
{value:335, name:'直接访问'}, |
|
|
|
|
|
{value:310, name:'邮件营销'}, |
|
|
|
|
|
{value:234, name:'联盟广告'}, |
|
|
|
|
|
{value:135, name:'视频广告'}, |
|
|
|
|
|
{value:1548, name:'搜索引擎'} |
|
|
|
|
|
|
|
|
data: [ |
|
|
|
|
|
{ value: 335, name: '直接访问' }, |
|
|
|
|
|
{ value: 310, name: '邮件营销' }, |
|
|
|
|
|
{ value: 234, name: '联盟广告' }, |
|
|
|
|
|
{ value: 135, name: '视频广告' }, |
|
|
|
|
|
{ value: 1548, name: '搜索引擎' } |
|
|
], |
|
|
], |
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
emphasis: { |
|
|
emphasis: { |
|
@ -183,10 +183,11 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
|
.chart { |
|
|
|
|
|
|
|
|
.chart-container { |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
float: left; |
|
|
float: left; |
|
|
} |
|
|
} |
|
|