Google Charts - Material Scatter Chart
You are Here:
How to Draw a Material Scatter Chart?
Please wait google chart is loading...
In this example, we will draw a material scatter chart. Please hover the points in the above chart to view particular details.
Example
HTML Online Editor
<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body>
<div id="point">
</div>
<script>
google.charts.load('current', {packages: ['corechart','scatter']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Age');
data.addColumn('number', 'Weight');
data.addRows([
[ 8, 11 ],
[ 5, 6.5 ],
[ 11, 14 ],
[ 4, 5 ],
[ 3, 3.5 ],
[ 6, 8 ]
]);
// Set chart options
var options = {
'title':'Age vs Weight',
'width':550,
'height':400,
hAxis: {
title: 'Age',
minValue: 0,
maxValue: 15
},
vAxis: {
title: 'Weight',
minValue: 0,
maxValue: 15
}
};
// Instantiate and draw the chart.
var chart = new google.charts.Scatter(document.getElementById('point'));
chart.draw(data, google.charts.Scatter.convertOptions(options));
}
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 98% of Google Charts Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in Google Charts.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.