【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]
        ]
    }
    ]
}
  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

打赏
文章很值,打赏犒劳作者一下
相关推荐
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页

打赏

长行

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者