-->
🏠 🔍
SHAREOLITE

SOLVED : Google charts - Line chart - working example

In this post , we share a sample HTML working example code of displaying a Line chart integrating with Google Chart APIs. Hope it may be useful to few beginners.

Copy paste the below HTML code in any editor and open in browser for display. For more details on customizing the charts visit Google charts web page.


<html>
<body>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart', 'bar']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(tcinfo);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function tcinfo() {
// Create the data table.
/////////////////////////////////////////////////////////////////////////////////////////
var chartdata = google.visualization.arrayToDataTable([
['Month', 'Count'],
['Jan16',10],
['Feb16',35],
['Mar16',24],
['Apr16',94],
['May16',35]
]);
var chartoptions = {
title: 'Analysis',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('chart_analysis'));
chart.draw(chartdata, chartoptions);
}
</script>
<div style="float: left; width: 25%" id="chart_analysis"></div>
<div style="clear:left;"></div>
<p><font face="Arial" size="2"><a href=http://shareolite.blogspot.com>For much more examples , Visit Shareolight.blogspot.com </a></p>
</body>
</html>

SOLVED - Google Charts - Horizontal Bar Stack chart - working example

In this post , we share a sample HTML working example code of displaying a Bar stack Horizontal chart integrating with Google Chart APIs. Hope it may be useful to few beginners.

Copy paste the below HTML code in any editor and open in browser for display. For more details on customizing the charts visit Google charts web page.






<html>
<body>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart', 'bar']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(tcinfo);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function tcinfo() {
// Create the data table.
/////////////////////////////////////////////////////////////////////////////////////////
var chartdata = google.visualization.arrayToDataTable([
['Category', 'Good', 'Bad'],
['Fruits',0,19],
['Vegetables',36,11],
['Cosmetics',10,8]
]);
var chartview = new google.visualization.DataView(chartdata);
chartview.setColumns([0, 1,
{ calc: "stringify",
sourceColumn: 1,
type: "string",
role: "annotation" },
2,
{ calc: "stringify",
sourceColumn: 1,
type: "string",
role: "annotation" }
]);
var chartoptions = {
isStacked: 'percent',
series: { 0: {color: '#7DCEA0'} , 1: {color: '#EC7063'} },
is3D:true,
height: 300,
legend: {position: 'top', maxLines: 3},
vAxis: {
minValue: 0,
ticks: []
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_analysis'));
chart.draw(chartdata, chartoptions);
}
</script>
<div style="float: left; width: 25%" id="chart_analysis"></div>
<div style="clear:left;"></div>
<p><font face="Arial" size="2"><a href=http://shareolite.blogspot.com>For much more examples , Visit Shareolight.blogspot.com </a></p>
</body>
</html>

SOLVED : Google Charts - Sample Pie Chart - working example

In this post , we share a sample HTML working example code of displaying a Pie-Chart integrating with Google Chart APIs. Hope it may be useful to few beginners.



Copy paste the below HTML code in any editor and open in browser for display. For more details on customizing the charts visit Google charts web page.

<html>
<body>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart', 'bar']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(tcinfo);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function tcinfo() {
// Create the data table.
/////////////////////////////////////////////////////////////////////////////////////////
var analysisdata = new google.visualization.DataTable();
analysisdata.addColumn('string', 'Status');
analysisdata.addColumn('number', 'Count');
analysisdata.addRows([
['Good', 55],
['Bad', 45]
]);
// Set chart options
var analysisoptions = {'title':'Analysis count',
'width':400,
'height':300,
'is3D':true,
'colors':['#7DCEA0', '#EC7063']
}
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_analysis'));
chart.draw(analysisdata,analysisoptions);
}
</script>
<div style="float: left; width: 25%" id="chart_analysis"></div>
<div style="clear:left;"></div>
<p><font face="Arial" size="2"><a href=http://shareolite.blogspot.com>For much more examples , Visit Shareolight.blogspot.com </a></p>
</body>
</html>

–>