1

I can't get rid of vertical line in the end of graph.

I have replicated problem here: http://jsfiddle.net/63BPw/4/

Color of grid lines is darkred and it's setted only in this part of js code:

grid: {
    aboveData: false,
    hoverable: true,
    clickable: true,
    color: "darkred",
    borderWidth: {
        top: 0,
        bottom: 1,
        left: 0,
        right: 0
    }
}

Console do not throw any errors. I don't use any margins from inside javascript file or external css files.

4

1 回答 1

3

我认为这可能是一个错误。

问题不在于您的网格设置,而在于每个轴的绘图。具体来说,您设置了 2 个 y 轴,一个在左侧,一个在右侧。在 flot 代码的深处,它根据轴是否是“最里面”来决定是否绘制一个“条”来附加刻度。当您有 2 个 yaxes 时,它错误地确定您的右侧 yaxis不是最里面的,因此绘制了一个刻度条。

相关代码,这两个位都称为每轴:

allocateAxisBoxFirstPhase

/*note this is only called for axes that have tickLength set
  but later it is checked as true/false, not undefined 
  (which is what you'd get if you set your yaxis tickLength = 0) */
var sameDirection = $.grep(all, function (a) {
  return a && a.reserveSpace;
});

innermost = $.inArray(axis, sameDirection) == 0;

drawGrid

if (!axis.innermost) {

   //in here it draws the tick bar

}

解决方法

找到那个!axis.innermost位并将其更改为axis.innermost == false. 在第二个 yaxis 中设置 tickLength = 0。而已。

我在这里实现了这两个更改:http: //jsfiddle.net/63BPw/5/

另外,仅供参考,我对此提出了一个错误:https ://github.com/flot/flot/issues/1056

于 2013-05-27T15:58:18.510 回答