Flot does not support axis labels on its own, but you can easily add them using html and css and change the parameters of your fleet a little.
The demo on the fleet site has a y axis label. It is created by adding divs to specific classes in the container for the fleet:
var xaxisLabel = $("<div class='axisLabel xaxisLabel'></div>") .text("My X Label") .appendTo($('#placeholder_1w')); var yaxisLabel = $("<div class='axisLabel yaxisLabel'></div>") .text("Response Time (ms)") .appendTo($('#placeholder_1w'));
Then you need CSS:
.axisLabel { position: absolute; text-align: center; font-size: 12px; } .xaxisLabel { bottom: 3px; left: 0; right: 0; } .yaxisLabel { top: 50%; left: 2px; transform: rotate(-90deg); -o-transform: rotate(-90deg); -ms-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -webkit-transform: rotate(-90deg); transform-origin: 0 0; -o-transform-origin: 0 0; -ms-transform-origin: 0 0; -moz-transform-origin: 0 0; -webkit-transform-origin: 0 0; }
If you need to support IE6 / 7, unfortunately, itβs more difficult for you to get around - you want your body tag to be marked with the class βie6β or βie7β by doing something like this:
<body>
And then this extra CSS:
.ie7 .yaxisLabel, .ie8 .yaxisLabel { top: 40%; font-size: 36px; filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.0, M12=0.33, M21=-0.33, M22=0.0,sizingMethod='auto expand'); }
Finally, in my attempts to do this, I found that I need to specify a fixed width mark for the y axis and a fixed High mark for xaxis.
See a working example here: http://jsfiddle.net/ryleyb/U82Dc/
Yley
source share