【ECharts实例】3D曲面图+散点图_曲面图

option = {
    tooltip: {
        shadowColor: 'rgba(0, 0, 0, 0)'
    },
    backgroundColor: '#fff',
    visualMap: [{
        show: false,
        dimension: 2,
        min: 0,
        max: 25,
        seriesIndex: 0,
        inRange: {
            color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
        }
    },{
        show: false,
        seriesIndex: 1,
        inRange: {
            symbolSize: 10,
            color: 'red'
        }
    }],
    xAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    yAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    zAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    grid3D: {
        viewControl: {
            alpha:55,
            beta:40
        },
        light: {
            main: {
                intensity: 0.7  // 光线强度
            }
        }
    },
    series: [{
        type: 'surface',
        zlevel: -10,
        wireframe: {
            show: true,
            lineStyle: {
                color: 'rgba(0,0,0,0.3)',
                width: 0.8
            }
        },
        equation: {
            x: {
                step: 0.5,
                min: -5,
                max: 5
            },
            y: {
                step: 0.5,
                min: -5,
                max: 5
            },
            z: function (x, y) {
                return (x*x+y*y)/2;
            }
        }
    },{
        type: 'scatter3D',
        symbol: 'circle',
        zlevel: 10,
        data: [
            [-3, 4, 12.5]
        ]
    }]
}

略微调整函数的Demo:

option = {
    tooltip: {
        shadowColor: 'rgba(0, 0, 0, 0)'
    },
    backgroundColor: '#fff',
    visualMap: [{
        show: false,
        dimension: 2,
        min: 0,
        max: 25,
        seriesIndex: 0,
        inRange: {
            color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
        }
    },{
        show: false,
        seriesIndex: 1,
        inRange: {
            symbolSize: 10,
            color: 'red'
        }
    }],
    xAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    yAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    zAxis3D: {
        type: 'value',
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgb(248,248,248)','rgb(248,248,248)']
            }
        }
    },
    grid3D: {
        viewControl: {
            alpha:55,
            beta:40
        },
        light: {
            main: {
                intensity: 0.7  // 光线强度
            }
        }
    },
    series: [{
        type: 'surface',
        zlevel: -10,
        wireframe: {
            show: true,
            lineStyle: {
                color: 'rgba(0,0,0,0.3)',
                width: 0.8
            }
        },
        equation: {
            x: {
                step: 0.5,
                min: -8,
                max: 2
            },
            y: {
                step: 0.5,
                min: -9,
                max: 1
            },
            z: function (x, y) {
                return ((x+3)*(x+3)+(y+4)*(y+4))/2;
            }
        }
    },
    {
        type: 'scatter3D',
        symbol: 'circle',
        zlevel: 10,
        data: [
            [0, 0, 12.5]
        ]
    }
    ]
}