2016-09-01 76 views
-1

我無法在highchart中獲取yAxis數據。看小提琴https://jsfiddle.net/LLExL/6496/ 我用下面的代碼加載highcharts。Highcharts no y data

$(function() { 
     $('#RankingReportsHistory').highcharts(
     {!! json_encode($KeywordVisibilityChart) !!} 
     ); 
    }) 

$ KeywordVisibilityChart的內容低於陣中,我從我在Laravel控制器的陣列,和我在X軸的所有日期,但在y軸可見圖表中沒有數據,但該數組包含yAxis和xAxis數據。

我認爲問題是yAxis數組包含雙qoutes,我如何最好地爲每個元素移除它們。

array:10 [▼ 
    "chart" => array:4 [▼ 
    "type" => "spline" 
    "renderTo" => "RankingReportsHistory" 
    "style" => array:2 [▼ 
     "fontFamily" => "open sans" 
     "letter-spacing" => "0.5px" 
    ] 
    "backgroundColor" => "#ffffff" 
    ] 
    "credits" => array:1 [▼ 
    "enabled" => false 
    ] 
    "rangeSelector" => array:1 [▼ 
    "selected" => "1" 
    ] 
    "title" => array:1 [▼ 
    "text" => false 
    ] 
    "subtitle" => array:1 [▼ 
    "text" => false 
    ] 
    "xAxis" => array:2 [▼ 
    "type" => "datetime" 
    "categories" => array:35 [▼ 
     0 => "14.07.2016" 
     1 => "15.07.2016" 
     2 => "16.07.2016" 
     3 => "17.07.2016" 
     4 => "18.07.2016" 
     5 => "19.07.2016" 
     6 => "20.07.2016" 
     7 => "21.07.2016" 
     8 => "22.07.2016" 
     9 => "23.07.2016" 
     10 => "24.07.2016" 
     11 => "25.07.2016" 
     12 => "26.07.2016" 
     13 => "27.07.2016" 
     14 => "28.07.2016" 
     15 => "29.07.2016" 
     16 => "31.07.2016" 
     17 => "01.08.2016" 
     18 => "02.08.2016" 
     19 => "03.08.2016" 
     20 => "04.08.2016" 
     21 => "12.08.2016" 
     22 => "17.08.2016" 
     23 => "19.08.2016" 
     24 => "21.08.2016" 
     25 => "22.08.2016" 
     26 => "23.08.2016" 
     27 => "24.08.2016" 
     28 => "25.08.2016" 
     29 => "26.08.2016" 
     30 => "27.08.2016" 
     31 => "29.08.2016" 
     32 => "30.08.2016" 
     33 => "31.08.2016" 
     34 => "01.09.2016" 
    ] 
    ] 
    "yAxis" => array:1 [▼ 
    "labels" => array:1 [▼ 
     "format" => "{value:.2f}" 
    ] 
    ] 
    "tooltip" => array:2 [▼ 
    "crosshairs" => true 
    "shared" => true 
    ] 
    "plotOptions" => array:1 [▼ 
    "spline" => array:1 [▼ 
     "marker" => array:3 [▼ 
     "radius" => 4 
     "lineColor" => "#fff" 
     "lineWidth" => 1 
     ] 
    ] 
    ] 
    "series" => array:1 [▼ 
    0 => array:5 [▼ 
     "name" => "domain.com" 
     "marker" => array:3 [▼ 
     "enabled" => true 
     "radius" => 5 
     "states" => array:1 [▶] 
     ] 
     "shadow" => true 
     "tooltip" => array:2 [▼ 
     "valueSuffix" => "%" 
     "valueDecimals" => 2 
     ] 
     "data" => array:35 [▼ 
     0 => "12.2667" 
     1 => "12.3667" 
     2 => "11.8" 
     3 => "11.9667" 
     4 => "11.8333" 
     5 => "11.9333" 
     6 => "12.5333" 
     7 => "12.7667" 
     8 => "11.8333" 
     9 => "12.9333" 
     10 => "12.9" 
     11 => "12.9667" 
     12 => "13.2" 
     13 => "13.3667" 
     14 => "13.4667" 
     15 => "13.4667" 
     16 => "12.7333" 
     17 => "13" 
     18 => "12.7" 
     19 => "12.7" 
     20 => "12.7" 
     21 => "12.1667" 
     22 => "11.8667" 
     23 => "11.8" 
     24 => "11.6667" 
     25 => "11.2" 
     26 => "11.2333" 
     27 => "11.3333" 
     28 => "11.2333" 
     29 => "11.9333" 
     30 => "12.0667" 
     31 => "11.6667" 
     32 => "11.5667" 
     33 => "11.5667" 
     34 => "11.9667" 
     ] 
    ] 
    ] 
] 

我希望這裏的任何人都能看到問題出在哪裏,我試着去看它的低谷,但沒有運氣。

只有我對這個網站做出的一點是,我把它移到了一個新的網絡服務器(vps)之前,我工作得很好。 我檢查了是否有任何文件,dident得到加載,但一切都加載得很好。

請幫幫我。 :)

感謝和親切的問候。

回答

-1

我剛剛弄明白了,這是因爲我的數據中有兩個qoutes進入yAxis。

所以以後我改變了這種代碼

$(function() { 
     $('#RankingReportsHistory').highcharts(
     {!! json_encode($KeywordVisibilityChart) !!} 
     ); 
    }) 

爲了這個代替,一切工作:)

$(function() { 
      $('#RankingReportsHistory').highcharts(
      {!! json_encode($KeywordVisibilityChart, JSON_NUMERIC_CHECK) !!} 
      ); 
     })