Documentation Home
MySQL Shell for VS Code


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

Pre-General Availability: 2023-01-18

9.4 DB Notebook: Show Data in Visual Graph Format

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