配置项如下
function normalDist(theta, x) {
return 1 / (theta * Math.sqrt(2 * Math.PI)) * Math.exp(- x * x / 2 / theta / theta);
}
function generateData(theta, min, max) {
var data = [];
for (var i = 0; i <= 20; i++) {
for (var j = 0; j <= 20; j++) {
var x = (max - min) * i / 20 + min;
var y = (max - min) * j / 20 + min;
data.push([x, y, normalDist(theta, x) * normalDist(theta, y)]);
}
}
return data;
}
option = {
xAxis: {
type: 'value',
min: -5,
max: 5,
interval: 1
},
yAxis: {
type: 'value',
min: -5,
max: 5,
interval: 1
},
visualMap: {
show: false,
min: 0,
max: 0.05,
inRange: {
color: ['#bf444c', '#d88273', '#f6efa6'],
symbolSize: [3, 40]
}
},
series: [
{
type: 'scatter',
data: generateData(2, -5, 5),
itemStyle: {
normal: {
opacity: 1
}
}
}
]
};