热力图,费率计划
配置项如下
// leftPadding+rightpadding+width*weekLength+leftMargin*weekLength-1
let padding = 30 //左右边距
let width = 150 //每个费率计划的宽度,一般是五或七个
let margin = 10 //每个费率距左边费率距离
//横轴
const minutes = ['00', '15', '30', '45']
// const minutes = ['00', '10', '20', '30', '40', '50']
// 生成grid(也就是布局,因为要计算每个热力图之间的距离,所以需要配置一下)
function GeneratorOptionGrid(length) {
let grid = []
let tempLeft = padding
for (let i = 0; i < length; i++) {
tempLeft = tempLeft * i == 0 ? tempLeft : tempLeft + margin + width
grid.push({
left: tempLeft,
width: width,
top: '80',
bottom: '20',
containLabel: true
})
}
console.log(grid)
return grid
}
option = {
"title": {
"text": "费率计划"
},
"tooltip": {
"position": "top"
},
"grid": [{
"left": "20",
'width':'130',
"top": "50",
"bottom": "20",
"containLabel": true
},{
"left": "160",
'width':'130',
"top": "50",
"bottom": "20",
"containLabel": true
},{
"left": "280",
'width':'130',
"top": "50",
"bottom": "20",
"containLabel": true
}, {
"left": "410",
'width':'130',
"top": "50",
"bottom": "20",
"containLabel": true
}, {
"left": "540",
'width':'130',
"top": "50",
"bottom": "20",
"containLabel": true
}],
"xAxis": [{
"gridIndex": 0,
"offset": 0,
"position": "top",
"type": "category",
"data": ["00", "15", "30", "45"],
"nameLocation": "center",
"nameTextStyle": {
"fontWeight": "bold",
"fontSize": "16",
"padding": [3, 4, 15, 6],
"color": "#606060"
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"gridIndex": 1,
"offset": 0,
"position": "top",
"type": "category",
"data": ["00", "15", "30", "45"],
"nameLocation": "center",
"nameTextStyle": {
"fontWeight": "bold",
"fontSize": "16",
"padding": [3, 4, 15, 6],
"color": "#606060"
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"gridIndex": 2,
"offset": 0,
"position": "top",
"type": "category",
"data": ["00", "15", "30", "45"],
"nameLocation": "center",
"nameTextStyle": {
"fontWeight": "bold",
"fontSize": "16",
"padding": [3, 4, 15, 6],
"color": "#606060"
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"gridIndex": 3,
"offset": 0,
"position": "top",
"type": "category",
"data": ["00", "15", "30", "45"],
"nameLocation": "center",
"nameTextStyle": {
"fontWeight": "bold",
"fontSize": "16",
"padding": [3, 4, 15, 6],
"color": "#606060"
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"gridIndex": 4,
"offset": 0,
"position": "top",
"type": "category",
"data": ["00", "15", "30", "45"],
"nameLocation": "center",
"nameTextStyle": {
"fontWeight": "bold",
"fontSize": "16",
"padding": [3, 4, 15, 6],
"color": "#606060"
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}],
"yAxis": [{
"type": "category",
"gridIndex": 0,
"data": ["23:00", "22:00", "21:00", "20:00", "19:00", "18:00", "17:00", "16:00", "15:00", "14:00", "13:00", "12:00", "11:00", "10:00", "09:00", "08:00", "07:00", "06:00", "05:00", "04:00", "03:00", "02:00", "01:00", "00:00"],
"axisLine": {
"lineStyle": {
"color": "#000"
}
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"type": "category",
"gridIndex": 1,
"data": ["23:00", "22:00", "21:00", "20:00", "19:00", "18:00", "17:00", "16:00", "15:00", "14:00", "13:00", "12:00", "11:00", "10:00", "09:00", "08:00", "07:00", "06:00", "05:00", "04:00", "03:00", "02:00", "01:00", "00:00"],
"axisLine": {
"lineStyle": {
"color": "#000"
}
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"type": "category",
"gridIndex": 2,
"data": ["23:00", "22:00", "21:00", "20:00", "19:00", "18:00", "17:00", "16:00", "15:00", "14:00", "13:00", "12:00", "11:00", "10:00", "09:00", "08:00", "07:00", "06:00", "05:00", "04:00", "03:00", "02:00", "01:00", "00:00"],
"axisLine": {
"lineStyle": {
"color": "#000"
}
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"type": "category",
"gridIndex": 3,
"data": ["23:00", "22:00", "21:00", "20:00", "19:00", "18:00", "17:00", "16:00", "15:00", "14:00", "13:00", "12:00", "11:00", "10:00", "09:00", "08:00", "07:00", "06:00", "05:00", "04:00", "03:00", "02:00", "01:00", "00:00"],
"axisLine": {
"lineStyle": {
"color": "#000"
}
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}, {
"type": "category",
"gridIndex": 4,
"data": ["23:00", "22:00", "21:00", "20:00", "19:00", "18:00", "17:00", "16:00", "15:00", "14:00", "13:00", "12:00", "11:00", "10:00", "09:00", "08:00", "07:00", "06:00", "05:00", "04:00", "03:00", "02:00", "01:00", "00:00"],
"axisLine": {
"lineStyle": {
"color": "#000"
}
},
"axisLabel": {
"interval": 0,
"rotate": 0
},
"splitArea": {
"show": true
}
}],
"visualMap": {
"show": true,
"right": 0,
"top": 10,
"align": "left",
"pieces": [{
"value": 0,
"label": "模拟费率0",
"color": "#c1232b"
}, {
"value": 1,
"label": "模拟费率1",
"color": "#27727b"
}, {
"value": 2,
"label": "模拟费率2",
"color": "#e87c25"
}, {
"value": 3,
"label": "模拟费率3",
"color": "#b5c334"
}, {
"value": 4,
"label": "模拟费率4",
"color": "#fe8463"
}, {
"value": 5,
"label": "模拟费率5",
"color": "#9bca63"
}, {
"value": 6,
"label": "模拟费率6",
"color": "#fad860"
}, {
"value": 7,
"label": "模拟费率7",
"color": "#f3a43b"
}, {
"value": 8,
"label": "模拟费率8",
"color": "#60c0dd"
}, {
"value": 9,
"label": "模拟费率9",
"color": "#d7504b"
}]
},
"series": [{
"name": "星期一",
"type": "heatmap",
"coordinateSystem": "cartesian2d",
"data": [
[0, 0, 6],
[0, 1, 1],
[0, 2, 0],
[0, 3, 4],
[0, 4, 3],
[0, 5, 7],
[0, 6, 6],
[0, 7, 4],
[0, 8, 4],
[0, 9, 0],
[0, 10, 7],
[0, 11, 0],
[0, 12, 2],
[0, 13, 2],
[0, 14, 5],
[0, 15, 3],
[0, 16, 6],
[0, 17, 8],
[0, 18, 6],
[0, 19, 6],
[0, 20, 7],
[0, 21, 2],
[0, 22, 8],
[0, 23, 6],
[1, 0, 5],
[1, 1, 7],
[1, 2, 7],
[1, 3, 8],
[1, 4, 7],
[1, 5, 8],
[1, 6, 2],
[1, 7, 0],
[1, 8, 4],
[1, 9, 6],
[1, 10, 6],
[1, 11, 6],
[1, 12, 7],
[1, 13, 1],
[1, 14, 4],
[1, 15, 2],
[1, 16, 5],
[1, 17, 7],
[1, 18, 3],
[1, 19, 3],
[1, 20, 5],
[1, 21, 5],
[1, 22, 6],
[1, 23, 8],
[2, 0, 1],
[2, 1, 6],
[2, 2, 4],
[2, 3, 4],
[2, 4, 4],
[2, 5, 6],
[2, 6, 2],
[2, 7, 1],
[2, 8, 4],
[2, 9, 0],
[2, 10, 4],
[2, 11, 2],
[2, 12, 4],
[2, 13, 2],
[2, 14, 3],
[2, 15, 6],
[2, 16, 1],
[2, 17, 3],
[2, 18, 7],
[2, 19, 6],
[2, 20, 0],
[2, 21, 6],
[2, 22, 3],
[2, 23, 1],
[3, 0, 1],
[3, 1, 1],
[3, 2, 6],
[3, 3, 6],
[3, 4, 2],
[3, 5, 8],
[3, 6, 3],
[3, 7, 2],
[3, 8, 2],
[3, 9, 6],
[3, 10, 0],
[3, 11, 5],
[3, 12, 1],
[3, 13, 6],
[3, 14, 2],
[3, 15, 4],
[3, 16, 1],
[3, 17, 2],
[3, 18, 5],
[3, 19, 3],
[3, 20, 0],
[3, 21, 4],
[3, 22, 6],
[3, 23, 7]
],
"label": {
"normal": {
"show": false
}
},
"gridIndex": 0,
"xAxisIndex": 0,
"yAxisIndex": 0,
"itemStyle": {
"emphasis": {
"shadowBlur": 5,
"shadowColor": "rgba(0,0,0,0.71)"
},
"borderWidth": 0.5,
"borderType": "solid",
"borderColor": "#ffffff"
}
}, {
"name": "星期二",
"type": "heatmap",
"coordinateSystem": "cartesian2d",
"data": [
[0, 0, 7],
[0, 1, 5],
[0, 2, 3],
[0, 3, 7],
[0, 4, 8],
[0, 5, 6],
[0, 6, 7],
[0, 7, 0],
[0, 8, 5],
[0, 9, 0],
[0, 10, 8],
[0, 11, 1],
[0, 12, 7],
[0, 13, 3],
[0, 14, 5],
[0, 15, 1],
[0, 16, 2],
[0, 17, 1],
[0, 18, 6],
[0, 19, 4],
[0, 20, 6],
[0, 21, 4],
[0, 22, 1],
[0, 23, 0],
[1, 0, 1],
[1, 1, 6],
[1, 2, 6],
[1, 3, 1],
[1, 4, 1],
[1, 5, 4],
[1, 6, 0],
[1, 7, 5],
[1, 8, 3],
[1, 9, 2],
[1, 10, 0],
[1, 11, 8],
[1, 12, 8],
[1, 13, 4],
[1, 14, 0],
[1, 15, 3],
[1, 16, 3],
[1, 17, 8],
[1, 18, 7],
[1, 19, 8],
[1, 20, 8],
[1, 21, 5],
[1, 22, 8],
[1, 23, 7],
[2, 0, 0],
[2, 1, 3],
[2, 2, 5],
[2, 3, 7],
[2, 4, 8],
[2, 5, 2],
[2, 6, 3],
[2, 7, 7],
[2, 8, 0],
[2, 9, 6],
[2, 10, 1],
[2, 11, 6],
[2, 12, 6],
[2, 13, 4],
[2, 14, 1],
[2, 15, 2],
[2, 16, 8],
[2, 17, 7],
[2, 18, 6],
[2, 19, 6],
[2, 20, 1],
[2, 21, 2],
[2, 22, 2],
[2, 23, 4],
[3, 0, 1],
[3, 1, 0],
[3, 2, 8],
[3, 3, 3],
[3, 4, 3],
[3, 5, 5],
[3, 6, 0],
[3, 7, 3],
[3, 8, 0],
[3, 9, 7],
[3, 10, 6],
[3, 11, 8],
[3, 12, 1],
[3, 13, 5],
[3, 14, 5],
[3, 15, 3],
[3, 16, 2],
[3, 17, 3],
[3, 18, 5],
[3, 19, 8],
[3, 20, 0],
[3, 21, 6],
[3, 22, 4],
[3, 23, 3]
],
"label": {
"normal": {
"show": false
}
},
"gridIndex": 1,
"xAxisIndex": 1,
"yAxisIndex": 1,
"itemStyle": {
"emphasis": {
"shadowBlur": 5,
"shadowColor": "rgba(0,0,0,0.71)"
},
"borderWidth": 0.5,
"borderType": "solid",
"borderColor": "#ffffff"
}
}, {
"name": "星期三",
"type": "heatmap",
"coordinateSystem": "cartesian2d",
"data": [
[0, 0, 4],
[0, 1, 3],
[0, 2, 4],
[0, 3, 0],
[0, 4, 4],
[0, 5, 3],
[0, 6, 3],
[0, 7, 2],
[0, 8, 5],
[0, 9, 0],
[0, 10, 1],
[0, 11, 3],
[0, 12, 8],
[0, 13, 7],
[0, 14, 2],
[0, 15, 1],
[0, 16, 5],
[0, 17, 2],
[0, 18, 6],
[0, 19, 4],
[0, 20, 7],
[0, 21, 6],
[0, 22, 3],
[0, 23, 5],
[1, 0, 0],
[1, 1, 8],
[1, 2, 2],
[1, 3, 8],
[1, 4, 2],
[1, 5, 3],
[1, 6, 6],
[1, 7, 5],
[1, 8, 2],
[1, 9, 8],
[1, 10, 3],
[1, 11, 2],
[1, 12, 6],
[1, 13, 3],
[1, 14, 6],
[1, 15, 1],
[1, 16, 8],
[1, 17, 5],
[1, 18, 7],
[1, 19, 0],
[1, 20, 8],
[1, 21, 6],
[1, 22, 2],
[1, 23, 6],
[2, 0, 8],
[2, 1, 4],
[2, 2, 6],
[2, 3, 3],
[2, 4, 3],
[2, 5, 1],
[2, 6, 0],
[2, 7, 4],
[2, 8, 1],
[2, 9, 1],
[2, 10, 1],
[2, 11, 2],
[2, 12, 8],
[2, 13, 5],
[2, 14, 7],
[2, 15, 3],
[2, 16, 8],
[2, 17, 5],
[2, 18, 1],
[2, 19, 2],
[2, 20, 3],
[2, 21, 2],
[2, 22, 2],
[2, 23, 4],
[3, 0, 1],
[3, 1, 4],
[3, 2, 6],
[3, 3, 0],
[3, 4, 5],
[3, 5, 7],
[3, 6, 1],
[3, 7, 3],
[3, 8, 6],
[3, 9, 2],
[3, 10, 2],
[3, 11, 0],
[3, 12, 6],
[3, 13, 4],
[3, 14, 2],
[3, 15, 3],
[3, 16, 6],
[3, 17, 8],
[3, 18, 1],
[3, 19, 4],
[3, 20, 0],
[3, 21, 8],
[3, 22, 0],
[3, 23, 8]
],
"label": {
"normal": {
"show": false
}
},
"gridIndex": 2,
"xAxisIndex": 2,
"yAxisIndex": 2,
"itemStyle": {
"emphasis": {
"shadowBlur": 5,
"shadowColor": "rgba(0,0,0,0.71)"
},
"borderWidth": 0.5,
"borderType": "solid",
"borderColor": "#ffffff"
}
}, {
"name": "星期四",
"type": "heatmap",
"coordinateSystem": "cartesian2d",
"data": [
[0, 0, 0],
[0, 1, 7],
[0, 2, 1],
[0, 3, 5],
[0, 4, 6],
[0, 5, 5],
[0, 6, 8],
[0, 7, 0],
[0, 8, 7],
[0, 9, 8],
[0, 10, 4],
[0, 11, 7],
[0, 12, 0],
[0, 13, 2],
[0, 14, 2],
[0, 15, 4],
[0, 16, 2],
[0, 17, 6],
[0, 18, 1],
[0, 19, 7],
[0, 20, 7],
[0, 21, 5],
[0, 22, 8],
[0, 23, 0],
[1, 0, 0],
[1, 1, 7],
[1, 2, 7],
[1, 3, 7],
[1, 4, 6],
[1, 5, 2],
[1, 6, 5],
[1, 7, 3],
[1, 8, 6],
[1, 9, 4],
[1, 10, 1],
[1, 11, 0],
[1, 12, 8],
[1, 13, 1],
[1, 14, 1],
[1, 15, 0],
[1, 16, 2],
[1, 17, 4],
[1, 18, 7],
[1, 19, 5],
[1, 20, 7],
[1, 21, 2],
[1, 22, 4],
[1, 23, 8],
[2, 0, 5],
[2, 1, 6],
[2, 2, 0],
[2, 3, 2],
[2, 4, 4],
[2, 5, 7],
[2, 6, 3],
[2, 7, 6],
[2, 8, 8],
[2, 9, 2],
[2, 10, 8],
[2, 11, 6],
[2, 12, 0],
[2, 13, 5],
[2, 14, 2],
[2, 15, 1],
[2, 16, 1],
[2, 17, 4],
[2, 18, 5],
[2, 19, 2],
[2, 20, 5],
[2, 21, 4],
[2, 22, 6],
[2, 23, 4],
[3, 0, 1],
[3, 1, 8],
[3, 2, 2],
[3, 3, 5],
[3, 4, 6],
[3, 5, 0],
[3, 6, 2],
[3, 7, 0],
[3, 8, 5],
[3, 9, 4],
[3, 10, 5],
[3, 11, 5],
[3, 12, 2],
[3, 13, 4],
[3, 14, 2],
[3, 15, 8],
[3, 16, 6],
[3, 17, 4],
[3, 18, 6],
[3, 19, 3],
[3, 20, 2],
[3, 21, 0],
[3, 22, 1],
[3, 23, 5]
],
"label": {
"normal": {
"show": false
}
},
"gridIndex": 3,
"xAxisIndex": 3,
"yAxisIndex": 3,
"itemStyle": {
"emphasis": {
"shadowBlur": 5,
"shadowColor": "rgba(0,0,0,0.71)"
},
"borderWidth": 0.5,
"borderType": "solid",
"borderColor": "#ffffff"
}
}, {
"name": "星期五",
"type": "heatmap",
"coordinateSystem": "cartesian2d",
"data": [
[0, 0, 4],
[0, 1, 2],
[0, 2, 3],
[0, 3, 1],
[0, 4, 4],
[0, 5, 0],
[0, 6, 8],
[0, 7, 7],
[0, 8, 6],
[0, 9, 4],
[0, 10, 1],
[0, 11, 6],
[0, 12, 6],
[0, 13, 1],
[0, 14, 0],
[0, 15, 3],
[0, 16, 4],
[0, 17, 6],
[0, 18, 7],
[0, 19, 1],
[0, 20, 4],
[0, 21, 6],
[0, 22, 3],
[0, 23, 5],
[1, 0, 2],
[1, 1, 5],
[1, 2, 2],
[1, 3, 2],
[1, 4, 2],
[1, 5, 6],
[1, 6, 2],
[1, 7, 6],
[1, 8, 7],
[1, 9, 8],
[1, 10, 1],
[1, 11, 5],
[1, 12, 0],
[1, 13, 6],
[1, 14, 0],
[1, 15, 5],
[1, 16, 8],
[1, 17, 6],
[1, 18, 2],
[1, 19, 5],
[1, 20, 1],
[1, 21, 1],
[1, 22, 1],
[1, 23, 7],
[2, 0, 5],
[2, 1, 1],
[2, 2, 4],
[2, 3, 3],
[2, 4, 1],
[2, 5, 5],
[2, 6, 8],
[2, 7, 3],
[2, 8, 2],
[2, 9, 6],
[2, 10, 4],
[2, 11, 2],
[2, 12, 7],
[2, 13, 5],
[2, 14, 2],
[2, 15, 1],
[2, 16, 4],
[2, 17, 6],
[2, 18, 0],
[2, 19, 8],
[2, 20, 2],
[2, 21, 7],
[2, 22, 0],
[2, 23, 3],
[3, 0, 6],
[3, 1, 1],
[3, 2, 6],
[3, 3, 8],
[3, 4, 4],
[3, 5, 7],
[3, 6, 5],
[3, 7, 0],
[3, 8, 1],
[3, 9, 6],
[3, 10, 4],
[3, 11, 3],
[3, 12, 0],
[3, 13, 5],
[3, 14, 7],
[3, 15, 4],
[3, 16, 5],
[3, 17, 3],
[3, 18, 2],
[3, 19, 4],
[3, 20, 8],
[3, 21, 7],
[3, 22, 6],
[3, 23, 6]
],
"label": {
"normal": {
"show": false
}
},
"gridIndex": 4,
"xAxisIndex": 4,
"yAxisIndex": 4,
"itemStyle": {
"emphasis": {
"shadowBlur": 5,
"shadowColor": "rgba(0,0,0,0.71)"
},
"borderWidth": 0.5,
"borderType": "solid",
"borderColor": "#ffffff"
}
}]
}