2016-02-01 172 views
0

我正在使用fusioncharts庫。我無法找到我爲scatter圖表發送的數據有什麼問題。散點圖不能正確渲染

演示 - JSFiddle

{ 
    "chart": { 
     "animation": 0, 
     "yaxisname": "OAE (%)", 
     "xaxisname": "Week", 
     "xaxismaxvalue": 54, 
     "xaxisminvalue": 0, 
     "showregressionline": "1", 
     "regressionlinethickness": "2", 
     "regressionLineColor": "008ee4", 
     "bgcolor": "FFFFFF", 
     "canvasborderthickness": "1", 
     "canvasbordercolor": "CCCCCC", 
     "showalternatehgridcolor": "0", 
     "divlineColor": "#FFFFFF", 
     "showLegend": "1", 
     "showValues": "1" 
    }, 
    "categories": [{ 
     "verticallinecolor": "c7c7c7", 
     "category": [{ 
      "label": "46", 
      "x": "46", 
      "showverticalline": "1" 
     }, { 
      "label": "47", 
      "x": "47", 
      "showverticalline": "1" 
     }, { 
      "label": "48", 
      "x": "48", 
      "showverticalline": "1" 
     }, { 
      "label": "49", 
      "x": "49", 
      "showverticalline": "1" 
     }, { 
      "label": "50", 
      "x": "50", 
      "showverticalline": "1" 
     }, { 
      "label": "51", 
      "x": "51", 
      "showverticalline": "1" 
     }, { 
      "label": "52", 
      "x": "52", 
      "showverticalline": "1" 
     }, { 
      "label": "53", 
      "x": "53", 
      "showverticalline": "1" 
     }, { 
      "label": "01", 
      "x": "01", 
      "showverticalline": "1" 
     }, { 
      "label": "02", 
      "x": "02", 
      "showverticalline": "1" 
     }, { 
      "label": "03", 
      "x": "03", 
      "showverticalline": "1" 
     }, { 
      "label": "04", 
      "x": "04", 
      "showverticalline": "1" 
     }] 
    }], 
    "dataset": [{ 
     "seriesname": "Target", 
     "color": "93cc1a", 
     "regressionLineColor": "93cc1a", 
     "showValues": "0", 
     "anchorradius": "0", 
     "anchorSides": "8", 
     "regressionLineThickness": "5", 
     "anchorBorderColor": "2A612D", 
     "anchorBgColor": "93cc1a", 
     "data": [{ 
      "y": "40%", 
      "x": "46" 
     }, { 
      "y": "40%", 
      "x": "47" 
     }, { 
      "y": "40%", 
      "x": "48" 
     }, { 
      "y": "40%", 
      "x": "49" 
     }, { 
      "y": "40%", 
      "x": "50" 
     }, { 
      "y": "40%", 
      "x": "51" 
     }, { 
      "y": "40%", 
      "x": "52" 
     }, { 
      "y": "40%", 
      "x": "53" 
     }, { 
      "y": "40%", 
      "x": "01" 
     }, { 
      "y": "40%", 
      "x": "02" 
     }, { 
      "y": "40%", 
      "x": "03" 
     }, { 
      "y": "40%", 
      "x": "04" 
     }] 
    }, { 
     "seriesname": "OAE", 
     "color": "008ee4", 
     "anchorradius": "5", 
     "anchorSides": "7", 
     "anchorBorderColor": "008ee4", 
     "anchorBgColor": "008ee4", 
     "data": [{ 
      "y": "29.73", 
      "x": "46" 
     }, { 
      "y": "100.36", 
      "x": "47" 
     }, { 
      "y": "69.37", 
      "x": "48" 
     }, { 
      "y": "55.55", 
      "x": "49" 
     }, { 
      "y": "64.4", 
      "x": "50" 
     }, { 
      "y": "135.43", 
      "x": "51" 
     }, { 
      "y": "55.02", 
      "x": "52" 
     }, { 
      "y": "NA", 
      "x": "53" 
     }, { 
      "y": "NA", 
      "x": "01" 
     }, { 
      "y": "73.36", 
      "x": "02" 
     }, { 
      "y": "8.28", 
      "x": "03" 
     }, { 
      "y": "137.91", 
      "x": "04" 
     }], 
     "dashed": "1" 
    }] 
} 

你可以看到有在圖表X軸之間的空間。此外,我希望該圖應該繪製X軸,因爲我傳遞的是類別對象。爲什麼它會自動排序。

回答

0

在撥弄,如果檢查爲最小的x軸的範圍爲01-04和46〜52

值最大值由於,沒有在任何標籤04之間和46,中間的空間是空的。圖表實際上是從01到52繪製的,沒有價值或標籤之間的空間不會被跳過。

你可以使用label來實現你想要的。它只是一個工作。

Updated Fiddle

"categories": [{ 
    "verticallinecolor": "c7c7c7", 
     "category": [{ 
     "label": "46", 
      "x": "0", 
      "showverticalline": "1" 
     }, { 
      "label": "47", 
      "x": "1", 
      "showverticalline": "1", 
     } //......