Table title not showing up

26 views
Skip to first unread message

Millie Allen

unread,
Jun 21, 2021, 3:53:03 PMJun 21
to Google Visualization API

Hello, I am trying to create a table but I am using a title and it is not appearing above the table, am I missing something?
Here is my current code:

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
    google.charts.load('current', {'packages':['table']});
    google.charts.setOnLoadCallback(drawTable);

    function drawTable() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Term');
    data.addColumn('number', 'Frequency');
    data.addRows([
        ['Car', 5],
        ['Bike', 3]
    ]);

    var options = {
        "title":"Most Popular Vehicles",
        width:"100%",
        height:"100%",
        showRowNumber: true
    };

    var table = new google.visualization.Table(document.getElementById('graph'));

    table.draw(data, {"title":"Most Popular Vehicles", width:"100%", height:"100%", showRowNumber: true});
    }
</script>

<div id = "graph"> 
</div>

As you can see, I have tried both
table.draw(data, {"title":"Most Popular Vehicles", width:"100%", height:"100%", showRowNumber: true});
and table.draw(data, options);
And neither are working.

Any help is appreciated, thanks
Reply all
Reply to author
Forward
0 new messages