*Why does only one chart? For earlier thanks for the reply. :)*
*Variant №1*
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["bar"]});
*google.setOnLoadCallback(function () {*
*drawChartProfit();*
*drawChart();*
*});*
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
['2015', 1170, 460, 250],
['2016', 660, 1120, 300],
['2017', 1030, 540, 350]
]);
var options = {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
}
};
var chart = new
google.charts.Bar(document.getElementById('columnchart_material'));
chart.draw(data, options);
}
function drawChartProfit() {
var dataProfit = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
['2015', 1170, 460, 250],
['2016', 660, 1120, 300],
['2017', 1030, 540, 350]
]);
var optionsProfit = {
chart: {
title: 'Company',
subtitle: 'Profit: 2014-2017',
}
};
var chartProfit = new
google.charts.Bar(document.getElementById('columnchart_Profitmaterial'));
chartProfit.draw(dataProfit, optionsProfit);
}
</script>
</head>
<body>
<div id="columnchart_material" style="width: 900px; height:
500px;"></div>
<br><br>
<div id="columnchart_Profitmaterial" style="width: 900px; height:
500px;"></div>
</body>
</html>
*Variant №2*
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["bar"]});
* google.setOnLoadCallback(drawChart);*
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
['2015', 1170, 460, 250],
['2016', 660, 1120, 300],
['2017', 1030, 540, 350]
]);
var options = {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
}
};
var chart = new
google.charts.Bar(document.getElementById('columnchart_material'));
chart.draw(data, options);
}
</script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["bar"]});
*google.setOnLoadCallback(drawChartProfit);*
function drawChartProfit() {
var dataProfit = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
['2015', 1170, 460, 250],
['2016', 660, 1120, 300],
['2017', 1030, 540, 350]
]);
var optionsProfit = {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
}
};
var chartProfit = new
google.charts.Bar(document.getElementById('columnchart_Profitmaterial'));
chartProfit.draw(dataProfit, optionsProfit);
}
</script>
</head>
<body>
<div id="columnchart_material" style="width: 900px; height:
500px;"></div>
<br><br>
<div id="columnchart_Profitmaterial" style="width: 900px; height:
500px;"></div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/1d491b6a-ce28-485c-8dd7-1688cba77059%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.