html代码就不写了,和其它的一样
var bar3d = echarts.init(document.getElementById('bar3d'));
var bar3dChart = {
title: {
text: '数据调阅',
top:'14%',
textStyle: {
color: '#fff',
fontSize: 17,
fontWeight:100
}
},
tooltip: {
formatter:function(params,ticket,callback){
var xIndex = params.value[0];
var yIndex = params.value[1];
var trips = 'X轴:' + bar3dDep[xIndex] + '
Y轴:' + bar3dYear[yIndex] + '
调阅量:' + params.value[2];
return trips
}
},
visualMap: {
show: false,
//数据区间
pieces: [
{ gte: 5000000},
{ gte: 4000000, lte: 4999999},
{ gte: 3000000, lte: 3999999},
{ gte: 2000000, lte: 2999999},
{ gte: 1000000, lte: 1999999},
{ gte: 500000, lte: 999999},
{ gte: 100000, lte: 499999},
{ gte: 10000, lte: 99999},
{ lte: 9999}
],
//根据区间定义颜色
inRange: {
color: ['#0ff4fe', '#0fbefe', '#0f81fe', '#6049f6', '#b039a8', '#da3f69', '#f02d4c', '#f35554', '#feac63']
}
},
xAxis3D: {
type: 'category',
data: bar3dDep,
splitLine: {
show: false
},
axisLabel: {
textStyle: {
color: '#a2a6b2',
fontSize: 10,
fontWeight:0
}
},
axisLine: {
lineStyle: {
color: '#a2a6b2',
width: 1
}
},
},
yAxis3D: {
type: 'category',
data: bar3dYear,
splitLine: {
show: false
},
axisLabel: {
textStyle: {
color: '#a2a6b2',
fontSize: 10,
fontWeight:0
}
},
axisLine: {
lineStyle: {
color: '#a2a6b2',
width: 1
}
}
},
zAxis3D: {
type: 'value',
axisLabel: {
formatter: numerbConvert,
textStyle: {
color: '#a2a6b2',
fontSize: 10,
fontWeight:0
}
},
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#a2a6b2',
width: 1
}
}
},
grid3D: {
// show: false,//坐标隐藏
boxWidth: 110,
boxDepth: 100,
viewControl: {
beta:0,
autoRotate:true,
// projection: 'orthographic'
},
light: {
main: {
intensity: 1.2,
shadow: true
},
ambient: {
intensity: 0.3
}
}
},
series: [{
type: 'bar3D',
data: [[0, 0, 3797], [1, 0, 1248], [2, 0, 707], [3, 0, 148], [4, 0, 30], [5, 0, 15], [1, 1, 134591], [0, 1, 116312], [3, 1, 61599], [2, 1, 23436], [5, 1, 14753], [4, 1, 7470], [6, 1, 371], [1, 2, 838261], [0, 2, 501929], [3, 2, 379966], [2, 2, 186263], [5, 2, 35981], [4, 2, 28406], [6, 2, 3246], [1, 3, 2802383], [0, 3, 1253565], [3, 3, 1091544], [2, 3, 893095], [4, 3, 53171], [5, 3, 37149], [6, 3, 8529], [1, 4, 4893099], [0, 4, 1536163], [3, 4, 1374233], [2, 4, 929384], [4, 4, 53483], [5, 4, 37987], [6, 4, 9489], [1, 5, 306649], [0, 5, 64502], [3, 5, 50011], [2, 5, 22732], [4, 5, 2620], [5, 5, 1363], [6, 5, 20]],
shading: 'lambert',
label: {
textStyle: {
fontSize: 12,
borderWidth: 1
}
},
emphasis: {
label: {
textStyle: {
fontSize: 12,
color: '#000',
fontWeight:100
}
}
}
}]
};
bar3d.setOption(bar3dChart);
window.addEventListener("resize", function () {
bar3d.resize();
})