Axis label in Flot

2019-03-08 23:33发布

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条回答
姐就是有狂的资本
2楼-- · 2019-03-08 23:58
$("<div class='axisLabel yaxisLabel'></div>")
        .text("Pressure")
        .appendTo($("#yl_1"));

This will works too.

查看更多
Deceive 欺骗
3楼-- · 2019-03-08 23:58

I use szpapas idea.

I added more jquery code below it to overwrite x-axis like this.

            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(1)').html("Berhad")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(2)').html("")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(3)').html("Sdn Bhd")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(4)').html("")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(5)').html("Enterprise")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(6)').html("")
            $('div.flot-x-axis div.flot-tick-label.tickLabel:nth-child(7)').html("Koperasi")
查看更多
聊天终结者
4楼-- · 2019-03-09 00:04

jqPlot has support for this, incase you're able to use an alternative

http://www.jqplot.com

查看更多
登录 后发表回答