blob: cd8cb26b1cb5e996be9e1da6d153a6bbc0299f03 [file] [log] [blame]
function getVirtulData(year) {
year = year || '2017';
var date = +echarts.number.parseDate(year + '-01-01');
var end = +echarts.number.parseDate((+year + 1) + '-01-01');
var dayTime = 3600 * 24 * 1000;
var data = [];
for (var time = date; time < end; time += dayTime) {
data.push([
echarts.format.formatTime('yyyy-MM-dd', time),
Math.floor(Math.random() * 1000)
]);
}
return data;
}
option = {
tooltip: {
position: 'top'
},
visualMap: {
min: 0,
max: 1000,
calculable: true,
orient: 'horizontal',
left: 'center',
top: 'top'
},
calendar: [{
range: '2017',
cellSize: ['auto', 20]
},
{
top: 260,
range: '2016',
cellSize: ['auto', 20]
},
{
top: 450,
range: '2015',
cellSize: ['auto', 20],
right: 5
}],
series: [{
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 0,
data: getVirtulData(2017)
}, {
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 1,
data: getVirtulData(2016)
}, {
type: 'heatmap',
coordinateSystem: 'calendar',
calendarIndex: 2,
data: getVirtulData(2015)
}]
};