配置项如下
var xData = ["01","02","03","04","05"];
var yData = ["01","02","03","04","05"];
var datas=[[["01","01",1],["01","02",1],["01","03",1],["01","04",1],["01","05",1],["02","01",1],["02","02",1],["02","03",1],["02","04",1],["02","05",1],["03","01",1],["03","02",1],["03","03",1],["03","04",1],["03","05",1],["04","01",1],["04","02",1],["04","04",1],["04","05",1],["05","02",1],["05","03",1],["05","04",1],["05","05",1]],[["01","01",1],["01","02",1],["01","03",1],["01","04",1],["01","05",1],["02","01",1],["02","02",1],["02","03",1],["02","04",1],["03","01",1],["03","03",1],["03","04",1],["03","05",1],["04","01",1],["04","02",1],["04","05",1],["05","02",1],["05","03",1],["05","04",1],["05","05",1]],[["01","04",1],["01","05",1],["02","01",1],["02","03",1],["02","04",1],["03","01",1],["03","03",1],["03","04",1],["04","01",1],["04","02",1],["04","05",1],["05","02",1],["05","03",1]],[["01","05",1],["02","01",1],["04","02",1],["05","02",1]]];
var series = [];
for (var i = 0; i < datas.length; i++) {
series.push({
type: 'bar3D',
data: datas[i],
dimensions: [{type: 'ordinal'}, {type: 'ordinal'}],
shading: 'color',
stack: 'stack',
label: {
show: false,
textStyle: {
fontSize: 16,
borderWidth: 1
}
},
itemStyle: {
opacity: 0.8
},
emphasis: {
label: {
textStyle: {
fontSize: 20,
color: '#900'
}
},
itemStyle: {
color: '#900'
}
}
});
}
var option = {
tooltip: {},
xAxis3D: {
type: 'category',
data: xData
},
yAxis3D: {
type: 'category',
data: yData
},
zAxis3D: {
type: 'value'
},
grid3D: {
boxWidth: 200,
boxDepth: 80,
light: {
main: {
intensity: 1.2
},
ambient: {
intensity: 0.3
}
}
},
series: series
}