将每小时每日每月数据从sql拉到jquery图表

I'm about to build a jquery chart that involves median order income number of customer etc for each day.

At this moment if I try my chart I get like 500 customers from the year 2012-2017 which is the total and not moving linearly to what I would like to.

What I want to make is that I get 0 - > 500 customers.

Could I loop these query or something to get data from all span and pull the number of customers so my data table shows, the neat line in the Jquery data-table?

Any pointers would be appreciated. I'm rather a novice on this kind of "advanced" MySQL queries

    $from_date = strtotime($fDay.date('F',mktime(0,0,0,$fMonth,15,2006)).$fYear);
    $to_date = strtotime($tDay.date('F',mktime(0,0,0,$tMonth,15,2006)).$tYear);

    $from_datetime = date_create(date("Y-m-d", $from_date));
    $to_datetime = date_create(date("Y-m-d", $to_date));

    //Statistikvariabler
    $all_orders = $DBcon->query("SELECT * FROM `order_structure` WHERE `date`>={$from_date} && `date`<={$to_date}");
    //Räkna ut totalsumma från och med nyår
    $all_orders_sum = $DBcon->query("SELECT * FROM `order_structure` WHERE `date`>={$from_date} && `date`<={$to_date}");
    $all_sum = 0;
    //Använd ovanstående för att räkna ut snittorder
    while($sum = $all_orders->fetch_assoc() ){
        $all_sum += $sum['sum'];
    }

    //Räkna ut debiterade timmar
    $all_orders_debs = $DBcon->query("SELECT * FROM `order_data` WHERE (`status`=3 || `status`=4) && `date`>={$from_date} && `date`<={$to_date}");
    $all_time = 0;
    $all_prods = 0;
    while( $debs = $all_orders_debs->fetch_assoc() ){
        $all_time += $debs['minutes'];
        $all_prods += $debs['sek'];
    }

Got it to work, was as I tought i needed to loop the data this is what I've got going at the moment.

  var e = {
    element: "areachart",
    behaveLikeLine: !1,
            parseTime: false,
    data: [
                <?php while($jsfix = $jstemp->fetch_array() ) { ?>

                {
                    x: '<?php echo $date = date('d-m-Y H:i:s', $jsfix['date']);?>',
                  s: '<?php echo $jsfix['sum'];?>',

            },
            <?php } ?>],
    xkey: "x",
    ykeys: ["s",],
    labels: ["Inkomst",],
    lineColors: ["#f9c1c1", "#c1daf9", "#3498db", "#2c3e50", "#1abc9c", "#34495e", "#9b59b6", "#e74c3c"]