Google Charts - Google Charts tutorial - Histogram Chart Buckets - chart js - google graphs - google charts examples




What is Histogram Chart Buckets?

  • A histogram is a chart that groups numeric data into bins, displaying the bins as segmented columns.
  • All bins are equal width and have a height proportional to the number of data points in the bin.
  • In other respects, histograms are similar to column charts.

Configurations:

  • We've used bucketSize configuration of histogram to change default bucket size of histogram chart.
// Set chart options
var options = {
   histogram: { bucketSize: 5 }
};
Clicking "Copy Code" button to copy the code. From - google charts tutorial - team

Example:

 Tryit<html>
<head>
<title>wikitechy Google Charts Tutorial  </title>
   <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
   <script type="text/javascript">
     google.charts.load('current', {packages: ['corechart']});     
   </script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
function drawChart() {
   // Define the chart to be drawn.
 var data = google.visualization.arrayToDataTable([
      ['Student Roll No', 'height'],
      ['1', 80],['2', 55],['3', 68],['4', 80],['5', 54],
      ['6', 70],['7', 85],['8', 78],['9', 70],['10', 58],
      ['11', 90],['12', 65],['13', 88],['14', 82],['15', 65],
      ['16', 86],['17', 45],['18', 62],['19', 84],['20', 75],
      ['21', 82],['22', 75],['23', 58],['24', 70],['25', 85]		  
      ]);
  
   // Set chart options
   var options = {
      title: 'Students height, in cms',
      legend: { position: 'none' },
      histogram: { bucketSize: 5 }
   };				

   // Instantiate and draw the chart.
   var chart = new google.visualization.Histogram(document.getElementById('container'));
   chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);
</script>
</body>
</html>
Clicking "Copy Code" button to copy the code. From - google charts tutorial - team

Output:


Related Searches to Google Charts - Histogram Chart Buckets

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×