Documentation Home
MySQL Shell for VS Code


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

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 LIMIT 10;", function (result) {
    var options: IGraphOptions = {
        series: [
            {
                id: "myFirstGraph",
                type: "bar",
                yLabel: "Country Population",
                data: result as IJsonGraphData,
                marginLeft: 60,
                marginBottom: 30,
                yDomain: [0, 50000000]
            },
        ],
    };
    Graph.render(options);
});