码迷,mamicode.com
首页 > 其他好文 > 详细

echarts Demo

时间:2020-06-04 15:41:58      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:商户   reverse   ide   tip   function   rownumber   height   gen   div   

 

 

1. div

<el-row :gutter="12">
<el-col :span="12">
<el-card shadow="always" class="el-row-class-top3">
<span style="margin-left: 0px;">
<div id="main" style="width: 750px;height:300px;"></div>
</span>
</el-card>
</el-col>
<el-col :span="12">
<el-card shadow="always" class="el-row-class-top3">
<span style="margin-left: 0px;">
<div id="main2" style="width: 750px;height:300px;"></div>
</span>
</el-card>
</el-col>
</el-row>

 

2.data

getIndexdata() {
// 3.基于准备好的dom,初始化echarts实例
var myChart = this.$ecahrter.init(document.getElementById(‘main‘))
var myChart2 =this.$ecahrter.init(document.getElementById(‘main2‘))
var myChart3 =this.$ecahrter.init(document.getElementById(‘main3‘))
var myChart4 =this.$ecahrter.init(document.getElementById(‘main4‘))
// 绘制图表
myChart.setOption({
title: {
text: ‘近7天订单总金额排行榜‘
},
tooltip: {},
xAxis: {
data: this.totalOrderAmout7days_date.reverse()
},
axisLabel: {
intreval:0,
formatter: function(params) {  //4个子长度换行显示文字
var newParamsName = ‘‘
var paramsNameNumber = params.length
var provideNumber = 4
var rowNumber = Math.ceil(paramsNameNumber / provideNumber)
for (let row = 0; row<rowNumber; row++) {
newParamsName +=
params.substring(
row * provideNumber,
(row + 1) * provideNumber
) + ‘\n‘
}
return newParamsName
},
// formatter:function(value,index) ////隔行显示文字
// {
// if (index % 2 != 0) {
// return ‘\n\n‘ + value;
// }
// else {
// return value;
// }
// //return value.toString().split("").join("\n"); //竖着显示文字
// },

},
yAxis: {},
series: [{
name: ‘订单金额‘,
type: ‘bar‘,
data: this.totalOrderAmout7days_data.reverse()
}]
});
myChart2.setOption({
title:{
text: ‘近7天订单量走势图‘
},
xAxis: {
type: ‘category‘,
data: this.totalOrderCount7days_date.reverse(),
},
axisLabel: {
intreval:0,
formatter: function(params) {
var newParamsName = ‘‘
var paramsNameNumber = params.length
var provideNumber = 4
var rowNumber = Math.ceil(paramsNameNumber / provideNumber)
for (let row = 0; row<rowNumber; row++) {
newParamsName +=
params.substring(
row * provideNumber,
(row + 1) * provideNumber
) + ‘\n‘
}
return newParamsName
},
textStyle: {
color: ‘#7c8893‘,
fontSize: 5
}
},
yAxis: {
type: ‘value‘
},
series: [{
data: this.totalOrderCount7days_data.reverse(),
type: ‘line‘
}]
});
myChart3.setOption({
title: {
text: ‘商户构成比例图‘,
subtext: ‘实时统计‘,
left: ‘center‘
},
tooltip: {
trigger: ‘item‘,
formatter: ‘{a} <br/>{b} : {c} ({d}%)‘
},
legend: {
orient: ‘vertical‘,
left: ‘left‘,
data: [‘运营商的商户‘, ‘代理商的商户‘, ‘业务员的商户‘]
},
series: [
{
name: ‘访问来源‘,
type: ‘pie‘,
radius: ‘55%‘,
center: [‘50%‘, ‘60%‘],
data:this.MchTypeData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: ‘rgba(0, 0, 0, 0.5)‘
}
}
}
]
});
myChart4.setOption({
title: {
text: ‘近7天开通商户走势图‘,
},
xAxis: {
type: ‘category‘,
data: this.totalMchCount7days_date.reverse(),
},
axisLabel: {
intreval:0,
formatter: function(params) {
var newParamsName = ‘‘
var paramsNameNumber = params.length
var provideNumber = 4
var rowNumber = Math.ceil(paramsNameNumber / provideNumber)
for (let row = 0; row<rowNumber; row++) {
newParamsName +=
params.substring(
row * provideNumber,
(row + 1) * provideNumber
) + ‘\n‘
}
return newParamsName
},
},
yAxis: {
type: ‘value‘
},
series: [{
data: this.totalMchCount7days_data.reverse(),
type: ‘line‘,
smooth: true
}]
});

}

echarts Demo

标签:商户   reverse   ide   tip   function   rownumber   height   gen   div   

原文地址:https://www.cnblogs.com/csj007523/p/13043604.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!