没有通过jQuery FLOT生成图形

时间:2019-04-28 21:54:37

标签: javascript php jquery json plot

我尝试生成一个图形,在该图形中我想显示订单总数和客户总数,但该图形不显示而不显示。 x:日期 y:总数

我将jquery flot用作库。

我的json结果(每日结果):

a = eval(input("Enter 0 to go on the ladder, and 1 to try out you new pair of plunger boots: "))
if a == 1:
    print("You put on the boots and climb on the side of the ship. You put one foot forward, then the next, then you try to take a step.")
    time.sleep(10)
    print("However, the boots won't budge.")
    time.sleep(2)
    print("MISSION FAIL")
    time.sleep(1)
else:
    print("You climb up the ladder.")
    time.sleep(2)
    print("You see a guard at the top armed with an automatic rifle.")
    time.sleep(4)
    print("You can use the grenade in your pocket, or you can take him out with your pack of C4")
    time.sleep(5)
    b = eval(input("Enter 0 for grenade, 1 for the pack of C4: ")
    if b == 0:
        print("You throw the grenade up.")
        time.sleep(3)
        print("You hear a smack, and you see the grenade coming back down at you.")
        time.sleep(4)
        print("MISSION FAIL")
        print("Mental note: These guards are known for their fast reflexes.")
        time.sleep(3.5)

我的ajax生成json(只是一个摘要)来帮助您:

sql结果:

[{"order":"18000.0000","customer":"1"},{"order":"456.0000","customer":"1"},{"order":"240.0000","customer":"1"}]

循环:

    array(2) {
  [0]=>
  array(5) {
    ["date_start"]=>
    string(19) "2019-04-20 08:17:08"
    ["date_end"]=>
    string(19) "2019-04-21 08:17:33"
    ["orders"]=>
    string(1) "2"
    ["products"]=>
    string(1) "4"
    ["sub_total"]=>
    string(10) "18456.0000"
  }
  [1]=>
  array(5) {
    ["date_start"]=>
    string(19) "2019-03-21 08:16:16"
    ["date_end"]=>
    string(19) "2019-03-21 08:16:16"
    ["orders"]=>
    string(1) "1"
    ["products"]=>
    string(1) "1"
    ["sub_total"]=>
    string(8) "240.0000"
  }
}

现在使用JavaScript生成图形:我认为在 if (is_array($result_array)) { foreach ($result_array as $result) { $json[] = ['order' => $result['sub_total'], 'customer' => $result['orders'], ]; } # JSON-encode the response $json_response = json_encode($json); //Return the JSON Array # Return the response echo $json_response 中,它缺少某些内容吗? 但我看不出问题出在哪里

json_response

注意:如果我未注释该错误,则什么也看不到,这就是为什么,现在是注释。

谢谢

不是:如果您需要更多信息,请在评论中告诉我

0 个答案:

没有答案