-
type='custom'
{
"tooltip": {
"position": "top",
"formatter": function (p) { var format = echarts.format.formatTime('yyyy-MM-dd', p.data[0]); return format + ': ' + p.data[1]; }
},
"calendar": [
{
"orient": "vertical",
"dayLabel": {
"firstDay": 1,
"nameMap": []
},
"monthLabel": {
"show": false
},
"yearLabel": {
"show": false
},
"itemStyle": {
"borderWidth": 15,
"borderColor": "rgba(0,0,0,1)",
"color": "#4D96E3"
},
"splitLine": {
"show": false
},
"cellSize": [
"50",
"50"
],
"range": "2021-11"
}
],
"series": [
{
"type": "custom",
"coordinateSystem": "calendar",
"renderItem": function (params, api) { const cellPoint = api.coord(api.value(0)); const cellWidth = params.coordSys.cellWidth; const cellHeight = params.coordSys.cellHeight; const value = api.value(1); if (isNaN(cellPoint[0]) || isNaN(cellPoint[1])) { return; } const group = { type: 'group', children: [ { type: 'text', style: { x: cellPoint[0], y: cellPoint[1] - cellHeight / 2 + 25, text: echarts.format.formatTime('dd', api.value(0)), fill: '#fff', width: '35', height: '35', textAlign: 'center', verticalAlign: 'center', textFont: api.font({ fontSize: 16 }), backgroundColor: api.value(2) ? '#41ABEB' : '#125791' } }, { type: 'text', style: { x: cellPoint[0] + 20, y: cellPoint[1] - cellHeight / 2 + 10, text: value, fill: '#fff', backgroundColor: !value ? '' : 'orange', width: '20', height: '20', fontSize: '14', textAlign: 'center', verticalAlign: 'center', borderWidth: '1' } } ] }; return group; },
"dimensions": [
null,
{
"type": "ordinal"
}
],
"data": [
[
"2021-11-01",
"3",
1
],
[
"2021-11-02",
"3",
1
],
[
"2021-11-03",
"3",
1
],
[
"2021-11-04",
"3",
1
],
[
"2021-11-05",
"",
1
],
[
"2021-11-06",
"",
0
],
[
"2021-11-07",
"",
1
],
[
"2021-11-08",
"",
1
],
[
"2021-11-09",
"",
1
],
[
"2021-11-10",
"3",
0
],
[
"2021-11-11",
"",
1
],
[
"2021-11-12",
"",
1
],
[
"2021-11-13",
"",
0
],
[
"2021-11-14",
"",
1
],
[
"2021-11-15",
"",
1
],
[
"2021-11-16",
"",
1
],
[
"2021-11-17",
"",
1
],
[
"2021-11-18",
"",
0
],
[
"2021-11-19",
"",
1
],
[
"2021-11-20",
"",
1
],
[
"2021-11-21",
"",
1
],
[
"2021-11-22",
"",
0
],
[
"2021-11-23",
"6",
1
],
[
"2021-11-24",
"",
1
],
[
"2021-11-25",
"",
1
],
[
"2021-11-26",
"",
1
],
[
"2021-11-27",
"",
0
],
[
"2021-11-28",
"",
0
],
[
"2021-11-29