2016-09-30 55 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

啊!非常感谢这个解决方案。是的,它的作品。还要感谢我指出了不规则间隔文件的文件。 :)很高兴。这里有你的观点。 –