markrcote / flot-axislabels

Axis Labels Plugin for Flot. This repo is unmaintained in part due to flot being in a similar situation.
95 stars 71 forks source link

Position axis labels correctly when axis itself is not shown #6

Closed cespare closed 12 years ago

cespare commented 12 years ago

This is a bit tricky, but it took me a while to debug. Basically, I was turning off the xaxis (with show: false) because I didn't want the axis ticks or grid marks to be shown. However, this causes flot to ignore the position argument, so the axis label is shown in the top left instead of at the bottom as expected.

It may or be not be in scope for you to change this behavior within your plugin. If it's not, you may want to add a note to your usage instructions to point out this detail.

For the record, here are the axis options that I set which fixed the problem by hiding the xaxis ticks and grid lines without using show: false:

position: "bottom",
show: true,
tickLength: 0,
labelHeight: 0,
tickFormatter: function() { return ""; }
markrcote commented 12 years ago

Hm since show: false causes the ticks and grid marks to be hidden, I think the axis label should also be hidden in this case. Do you agree?

cespare commented 12 years ago

That would be strictly better (more consistent) behavior than the current, yes.

markrcote commented 12 years ago

Fixed.