How do I create a dispersion chart with PHP? [closed]

1

I'm trying to create a table or scatter chart that shows the number of successful and failed logueos of a PHP form but after a lot of searching I did not find a tutorial or something to guide me. This is an example of what I'm looking for link At the moment I only want to create the graph and write the variables of X (date or month) and Y (Numbers)

    
asked by Beta 04.10.2017 в 07:56
source

1 answer

3

Here's how to do it with google charts. All you have to do is pass the data with PHP in the variable "data". The example is in particular a scatter plot. I hope it helps you.

<script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Age', 'Weight'],
          [ 8,      12],
          [ 4,      5.5],
          [ 11,     14],
          [ 4,      5],
          [ 3,      3.5],
          [ 6.5,    7]
        ]);

        var options = {
          title: 'Age vs. Weight comparison',
          hAxis: {title: 'Age', minValue: 0, maxValue: 15},
          vAxis: {title: 'Weight', minValue: 0, maxValue: 15},
          legend: 'none'
        };

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

        chart.draw(data, options);
      }
    </script>

You have an example of how the graphic and the code would be right at the bottom of this URL: link

    
answered by 04.10.2017 в 09:41