用于 VS 代码的 MySQL Shell GUI / MySQL Shell  / 第 8 章 JavaScript  /  8.4 DB Notebook:以可视化图形格式显示数据

全面上市前:2022-11-17

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

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

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