Axis label in Flot

后端 未结 9 1275
长情又很酷
长情又很酷 2021-01-31 14:15

Does anyone know how one can set the label or title of an axis in Flot?

I\'ve read the API but it doesn\'t seem to have that feature...

Thanks :)

9条回答
  •  滥情空心
    2021-01-31 14:43

    i'm using this workaround:

    yaxis: {
    tickFormatter: function(val, axis) { return val < axis.max ? val.toFixed(2) : "CZK/l";}
    }
    

    Very simple, the max value on the Y axis is replaced by a custom string. I've not tested on the X axis, but I see no reason why it shouldn't work.

提交回复
热议问题