0% found this document useful (0 votes)
33 views1 page

Google Charts: Bar Chart Guide

The document is an HTML file that implements a basic bar chart using Google Charts. It includes JavaScript to load the Google Charts API, create a data table with sales data from 2019 to 2023, and draw the chart with specified options. The chart is displayed in a div element with the ID 'chart_div'.

Uploaded by

dhanapriyad2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Google Charts: Bar Chart Guide

The document is an HTML file that implements a basic bar chart using Google Charts. It includes JavaScript to load the Google Charts API, create a data table with sales data from 2019 to 2023, and draw the chart with specified options. The chart is displayed in a div element with the ID 'chart_div'.

Uploaded by

dhanapriyad2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Google Charts - Basic Bar Chart</title>
<script type="text/javascript"
src="[Link]
<script type="text/javascript">
// Load the Google Charts API
[Link]('current', {packages: ['corechart']});

// Set callback function to draw the chart


[Link](drawChart);

function drawChart() {
// Create the data table
var data = [Link]([
['Year', 'Sales'],
['2019', 500],
['2020', 800],
['2021', 1200],
['2022', 1500],
['2023', 1800]
]);

// Set chart options


var options = {
title: 'Company Sales Over the Years',
hAxis: { title: 'Year' },
vAxis: { title: 'Sales' },
width: 600,
height: 400,
colors: ['#4285F4']
};

// Create and draw the bar chart


var chart = new
[Link]([Link]('chart_div'));
[Link](data, options);
}
</script>
</head>
<body>
<h2>Google Charts - Basic Bar Chart</h2>
<div id="chart_div"></div> <!-- This is where the chart will be displayed -->
</body>
</html>

You might also like