कैसे करें - गूगल चार्ट
अपने वेब पेज पर Google चार्ट जोड़ने का तरीका जानें।
उदाहरण
गूगल पाई चार्ट
एक साधारण बुनियादी वेब पेज से शुरू करें।
"piechart" आईडी के साथ एक <div> तत्व जोड़ें:
उदाहरण
<!DOCTYPE html>
<html>
<body>
<h1>My Web Page</h1>
<div id="piechart"></div>
</body>
<html>
google.com पर चार्ट एपीआई का संदर्भ जोड़ें:
उदाहरण
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
और एक जावास्क्रिप्ट फ़ंक्शन जोड़ें:
उदाहरण
<script type="text/javascript">
// Load google charts
google.charts.load('current',
{'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
// Draw the chart and set the chart values
function drawChart() {
var data =
google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 8],
['Friends', 2],
['Eat', 2],
['TV',
2],
['Gym', 2],
['Sleep', 8]
]);
// Optional; add
a title and set the width and height of the chart
var options = {'title':'My
Average Day', 'width':550, 'height':400};
// Display the chart
inside the <div> element with id="piechart"
var chart = new
google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>