2017-07-20 91 views
0

我已經嘗試了十幾種不同的解決方案,但是直接在tick上直接開始/結束時,網格線似乎總是懸垂着。我正在尋找一個解決方案,以消除這個懸而未決,或稍微改變開始/結束點,以便他們出現在線上,但不要觸發這個懸而未決彈出。在Angular/TypeScript環境中工作。HighCharts:刪除GridLine Overhang(Angular/TypeScript)

網格線懸: enter image description here

當前圖形設置:

chart: { 
    type: 'spline' 
}, 
title: null, 
xAxis: [{ 
     categories: [ 
      'Open 11am', '12', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10pm close' 
     ], 
    gridLineWidth: 1, 
    labels: { 
    enabled: true 
    }, 
    tickWidth: 0, 
    tickmarkPlacement: 'on', 
    startOnTick: true 
}], 
yAxis: [{ 
    title: null, 
    labels: { 
     x: 0, 
     y: -2 
    }, 
    tickLength: 0, 
    tickWidth: 0 
}], 
series: [{ 
    name: null, 
    data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    marker: { 
    fillColor: '#FFFFFF', 
    lineWidth: 2, 
    lineColor: null 
    } 
}], 
    credits: { 
     enabled: false 
    }, 
    legend: { 
    enabled: false 
    } 

我怎樣才能防止這種過剩的顯示出來,同時對起點和終點類別刻度線?

我試過幾乎所有我遇到的選項,但我承認我對HighCharts API還是比較新的。感謝您提前回復。

編輯:

這裏有一個jsfiddle提供的問題。

回答

1

更新您的xAxis作爲

//startOnTick: true, 
min: .5, 
max: 10.5, 

updated Fiddle

分鐘.5和最大10.5固定值,它消除了空間,也從代碼中刪除startOnTick: true因爲它迫使從蜱開始。 但在同一時間它修改與省略號,所以如果省略號是不需要的評論

+0

你也可以使用旋轉標籤 –