zl程序教程

您现在的位置是:首页 >  后端

当前栏目

242Echarts - 3D 散点图(3D Scatter with Dataset)

3D with Dataset 散点图 scatter
2023-09-11 14:15:41 时间

效果图

在这里插入图片描述

源代码

$.get('data/asset/data/life-expectancy-table.json', function (data) {
    var symbolSize = 2.5;
    option = {
        grid3D: {},
        xAxis3D: {
            type: 'category'
        },
        yAxis3D: {},
        zAxis3D: {},
        dataset: {
            dimensions: [
                'Income',
                'Life Expectancy',
                'Population',
                'Country',
                {name: 'Year', type: 'ordinal'}
            ],
            source: data
        },
        series: [
            {
                type: 'scatter3D',
                symbolSize: symbolSize,
                encode: {
                    x: 'Country',
                    y: 'Life Expectancy',
                    z: 'Income',
                    tooltip: [0, 1, 2, 3, 4]
                }
            }
        ]
    };

    myChart.setOption(option);
});