如何在 Flot 中显示没有 Y 轴的水平网格线?

How to show horizontal grid lines without the Y-Axis in Flot?

我一直在搜索 flot docs 和示例,寻找一种方法来显示水平(y 轴)网格线而不绘制垂直轴值(例如 0 到 100),但没有成功。

有没有办法在没有 y 轴值的情况下做到这一点?

而不是这个:

是,使用 tickFormatter:

yaxis: {
  tickFormatter: function(){return ''}
}

https://github.com/flot/flot/blob/master/API.md#customizing-the-axes

Fiddle