2016-09-30 58 views
0

我用兩條不同的線做了折線圖,每條線在xAxis中映射時間,但曲線中的點不與yAxis重合。標記中的值與tick選項完全不匹配。我不確定發生了什麼問題。如果在同一時間內有兩個數據點,則會發生這種奇怪的行爲。我不知道該怎麼辦?該圖像是如下: -爲什麼標記點與Highcharts中的yAxis不一致?

enter image description here 的代碼可以在小提琴被發現,以及在這裏http://jsfiddle.net/Cp73s/5394/ 的配置和數據如下所述: -

"options": { 
     "chart": { 
     "type": "line", 
     "zoomType": "yx", 
     "animation": true, 
     "spacingBottom": 15, 
     "spacingTop": 5, 
     "spacingLeft": 10, 
     "spacingRight": 10, 
     "reflow": true 
     }, 
     "exporting": { 
     "enabled": false 
     }, 
     "colors": ["#2C91DE", "#165A8E"], 
     "plotOptions": { 
     "line": { 
      "marker": { 
      "symbol": "circle" 
      } 
     }, 
     "series": { 
      "stacking": "normal", 
      "marker": { 
      "lineWidth": 0, 
      "lineColor": null, 
      "enabled": true, 
      "radius": 5 
      } 
     } 
     }, 
     "tooltip": { 
     "shared": true, 
     "crosshairs": true, 
     "followPointer": true, 
     "borderColor": null 
     } 
    }, 
    "title": { 
     "text": "Blood Pressure" 
    }, 
    "loading": false, 
    "xAxis": { 
     "startOnTick": true, 
     "endOnTick": true, 
     "tickInterval": 86400000, 
     "type": "datetime", 
     "title": { 
     "text": "Date/Time" 
     }, 
     "labels": { 
     "rotation": -60, 
     "format": "{value:%m-%d-%Y}", 
     "align": "right" 
     } 
    }, 
    "series": [{ 
     "name": "Systolic", 
     "data": [{ 
     "x": 1472980051000, 
     "y": 43, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1472980051000, 
     "y": 34, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1473066451000, 
     "y": 120, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1473697392000, 
     "y": 119, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473710858000, 
     "y": 120, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473710858000, 
     "y": 120, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473711048000, 
     "y": 114, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473711048000, 
     "y": 114, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1474548167000, 
     "y": 95, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474647485000, 
     "y": 106, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474647535000, 
     "y": 106, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474654052000, 
     "y": 93, 
     "fillColor": "#f1c40f" 
     }] 
    }, { 
     "name": "Diastolic", 
     "data": [{ 
     "x": 1472980051000, 
     "y": 53, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1472980051000, 
     "y": 120, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1473066451000, 
     "y": 32, 
     "fillColor": "#e74c3c" 
     }, { 
     "x": 1473697392000, 
     "y": 70, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473710858000, 
     "y": 80, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473710858000, 
     "y": 80, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473711048000, 
     "y": 68, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1473711048000, 
     "y": 68, 
     "fillColor": "#2ecc71" 
     }, { 
     "x": 1474548167000, 
     "y": 55, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474647485000, 
     "y": 57, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474647535000, 
     "y": 59, 
     "fillColor": "#f1c40f" 
     }, { 
     "x": 1474654052000, 
     "y": 54, 
     "fillColor": "#f1c40f" 
     }] 
    }], 
    "yAxis": { 
     "title": { 
     "text": "mmHg" 
     } 
    } 
    } 
+0

爲什麼他們會?軸標籤定期標記 - 每天的開始。您的數據點是在那些日子的特定時間繪製事件,並相應放置。這不是奇怪的行爲,而是期望的行爲 - 點將繪製在您告訴圖表繪製它們的位置。你想在你的場景中看到什麼行爲? – jlbriggs

+0

@jlbriggs所以你可以幫助我理解如何得到一個適當的圖表,而不是這個。我希望這些在適當的時間和間隔可以改變,但我不希望這種行爲。另一方面,任何文件也會有所幫助。我已經爲此提出了一個小提琴。謝謝 –

+0

@jlbriggs我希望看到折線圖,以便點顯示yAxis中的確切值。請幫忙。 –

回答

1

對不起,我誤解你的帖子指的是x軸。

在你plotOptions,您指定:

"stacking": "normal" 

你告訴圖表堆疊串聯彼此的頂部。

刪除,和值正確反映y值:

+0

啊!非常感謝這個解決方案。是的,它的作品。還要感謝我指出了不規則間隔文件的文件。 :)很高興。這裏有你的觀點。 –