Scatter Chart Example

An example of a Google Scatter Chart.

by schrodingers

HTML

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
       <div id="chart_div" style="width: 900px; height: 500px;"></div>

JavaScript

google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Day', 'IgG'],
          [ 7,      37],
          [ 14,      10],
          [ 15,     15],
          [ 16,     35],
          [ 16,     40],
          [ 16,     57],
          [ 16,     77],
          [ 17,     77],
          [ 17,     80],
          [ 18,     20],
          [ 18,     40],
          [ 20,     20],
          [ 20,     82],
          [ 21,     22],
          [ 21,     57],
          [ 21,     60],
          [ 21,     77],
          [ 21,     60],
          [ 25,     25],
          [ 25,     55],
          [ 25,     80],
          [ 27,     180],
					
          [ 50,    37]
        ]);

        var options = {
          title: '',
          hAxis: {title: 'Day', minValue: 7, maxValue: 60},
          vAxis: {title: 'IgG', minValue: 10, maxValue: 200},
          legend: 'none'
        };

        var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));

        chart.draw(data, options);
      }