score:0

Accepted answer

Replace one of the series with this:

series: [{
name: 'massively overweight',
data: 
    <?php
    $mysqli = new mysqli("example.com", "user", "password", "database");
    if ($mysqli->connect_errno) {
        echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
    }

    $res = $mysqli->query("SELECT date(date, '%b') as month, count(*) as cnt FROM diagnosis where illness = 'massively overweight'");

    while ($row = $res->fetch_assoc()) {
        $fat_people = $row['cnt'];
    }

    json_encode($cnt)

    ?>
}, {

score:0

current_page.php

<script>
$.post( 'get_graph_data.php"', {'id':'data_id'}, function(data) {
var data = jQuery.parseJSON(data);
chart = new Highcharts.Chart({data});

})
</script>

get_graph_data.php

//get data from database
// make array like this
array(
"chart"=> array(
"renderTo"=> 'container',
"type"=> 'column'
        ),
        "title"=> array(
            "text"=> 'Monthly Average Rainfall'
        ),
        "subtitle"=> array(
            'text'=> array('Source'=> 'WorldClimate.com')
        ),
        'xAxis'=> array(
            'categories'=>array( 
                'Jan',
                'Feb',
                'Mar',
                'Apr',
                'May',
                'Jun',
                'Jul',
                'Aug',
                'Sep',
                'Oct',
                'Nov',
                'Dec'));
   so on............
echo json_encode($above_array);

score:0

How your dates looks like? Because Highcharts use timestamps in miliseconds, so probably you need to parse your date by Date.UTC() or use time in appropriate format.

btw. How your JSON looks like?


Related Query

More Query from same tag