Documentation Home
MySQL Shell for VS Code


MySQL Shell for VS Code  /  JavaScript  /  DB Notebook: Show Data in Visual Graph Format

Pre-General Availability: 2023-01-18

8.4 DB Notebook: Show Data in Visual Graph Format

DB Notebook: Display population in a bar chart using 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);
});