代码如下:
var myDate = new Date();
var year = myDate.getFullYear();
option = {
title: {
top: 30,
left: 'center',
text: year
},
tooltip: {
//显示日期和数据
formatter: function (p) {
var format = echarts.format.formatTime('yyyy-MM-dd', p.data[0]);
return format + ': ' + p.data[1];
}
},
visualMap: {
min: 0,
max: 10000,
type: 'piecewise',
orient: 'horizontal',
left: 'center',
top: 65,
textStyle: {
color: '#b3b1b1'
}
},
calendar: {
top: 120,
left: 50,
right: 50,
cellSize: ['auto', 20],
range:year,
itemStyle: {
borderWidth: 0.5
},
yearLabel: {show: false},
//x轴坐标
monthLabel:{
nameMap: ['一月', '二月', '三月', '四月', '五月', '六月', '七月','八月','九月','十月','十一月','十二月']
},
//y轴坐标
dayLabel:{
nameMap: ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
}
},
series: {
type: 'heatmap',
coordinateSystem: 'calendar',
data:data
}
};