配置项如下
let data = [];
function getRandomIntger() {
let min = -50 ;
let max = 50 ;
return Math.floor( Math.random() * (max + 1 - min) ) + min ;
}
for(let i=0;i<10;i++) {
let xData = getRandomIntger();
let yData = getRandomIntger();
let zData = getRandomIntger();
data[i] = [xData, yData, zData];
}
option = {
xAxis3D: {
type: 'value',
max:50,
min:-50
},
yAxis3D: {
type: 'value',
max:50,
min:-50
},
zAxis3D: {
type: 'value',
max:50,
min:-50
},
grid3D: {
show: true,
axisLine: {
lineStyle: {
color: '#fff'
}
},
axisPointer: {
lineStyle: {
color: '#ffbd67'
}
}
},
visualMap: {
type:'piecewise',
show:true,
min: -50,
max: 50,
dimension: 0,
splitNumber: 5,
inRange: {
color: ['#d94e5d','#eac736','#50a3ba'],
symbol: ['circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'],
},
textStyle: {
color: '#fff'
},
pieces: [
// {gt: 0, lte: 50, color: '#e84e40', symbol: 'rect'},
// {gt: -50, lte: 0, color: '#ffed26', symbol: 'pin'},
],
},
series: [{
showAllSymbol: true,
type: 'scatter3D',
// coordinateSystem: 'cartesian3D',
data:data,
symbolSize: 15,
}]
};