Php

Creating Dashboards Using Google Charts. PHP, and MySQL Database (Subtitles Added)



I recommend you turn on the Subtitles for understanding better.

Similar Posts

35 thoughts on “Creating Dashboards Using Google Charts. PHP, and MySQL Database (Subtitles Added)
  1. Please. Can you help me.
    I want to draw another air line, but I do not know where wrong, but could not draw chart.
    <?php
    $servername = 'localhost';

    $username = 'abc';

    $password = 'xxx';

    $dbname = 'abc';

    $mysqli = new mysqli($servername, $username, $password, $dbname);
    if($mysqli->connect_error){
    die("Connection failed: ". $mysqli->connect_error);
    }

    $query = "SELECT * FROM data_zigbee";
    $qresult= $mysqli->query($query);
    $results = array();

    while ($res = $qresult->fetch_assoc()) {
    $results[] = $res;
    }

    $line_chart_data = array();
    foreach ($results as $result) {
    $line_chart_data[] = array($result['timeupload'],$result['humidity'],$result['temperature']);

    }

    $line_chart_data = json_encode($line_chart_data);

    mysqli_free_result($qresult);

    mysqli_close($mysqli);

    ?>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>

    <script type="text/javascript">

    google.load('visualization', '1',{'packages':['corechart'] } );

    google.setOnLoadCallback(drawAnnotations);

    function drawAnnotations(){

    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Date');
    data.addColumn('number', 'Humidity');
    data.addColumn('number', 'Temperature');
    data.addRows(<?php echo $line_chart_data?>);

    var options = {
    width: 600,
    height: 400,
    legend: { position: 'top', maxLines: 3},
    line : {groupWidth: '75%'},

    isStacked: true

    };

    var chart = new google.visualization.LineChart(document.getElementById('line_chart_div'));
    chart.draw(data, options);
    }

    </script>

    </head>

    <body>a
    <div id='line_chart_div'> </div>

    </body>

  2. how to download dashboard that youve downloaded under your screen? im little bit confused when you open your application (i mean dreamwaver) and then there are so many chart. how can be like that? thankyou for respon sir.

  3. nice tutorial~! but the background music drove me sleepy within the first 5 min.. let me advice a more dynamic song given that there's no voice explaining/following the instructions.

Leave a Reply

Your email address will not be published. Required fields are marked *