用于 VS 代码的 MySQL Shell GUI / MySQL Shell  / 第 9 章打字稿  /  9.4 DB Notebook:以可视化图形格式显示数据

全面上市前:2022-11-17

9.4 DB Notebook:以可视化图形格式显示数据

DB Notebook:使用 LIMIT 和 ORDER BY 在条形图中显示人口

runSql("SELECT Name, Population FROM world.country ORDER BY Population DESC LIMIT 10;", 
    function (result) {
        var options = {
            series: [
                {
                    type: "bar",
                    yLabel: "Country Population",
                    data: result,
                    marginLeft: 100,
                    marginBottom: 30,
                    yDomain: [0, 1500000000]
                },
            ],
        };
    var graph = new Graph();
    graph.render(options);
});