Skip to main content

Bar Chart

Google Charts Tutorial

<!Doctype html>
<html>
<head>
    <title>Google Charts Tutorial</title>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
        google.charts.load('current', {
            packages: ['corechart']
        });
    </script>
</head>
<body>
    <div id="container" style="width: 100%; height: 400px; margin: 0 auto"></div>
    <script language="JavaScript">
        function drawChart() {
            /* Define the chart to be drawn.*/
            var data = google.visualization.arrayToDataTable([
                ['Positive', 'Positive Test Results'],
['Dead Birds', 3],
['Sentinel Chickens', 27],               
['Mosquito', 37],
            ]);
            var options = {
                title: 'West Nile Positives 2022',
                isStacked: true
            };
            /* Instantiate and draw the chart.*/
            var chart = new google.visualization.BarChart(document.getElementById('container'));
            chart.draw(data, options);
        }
        google.charts.setOnLoadCallback(drawChart);
    </script>
</body>
</html>