From 6277b34c860e39867172e41fe56070f9b947324e Mon Sep 17 00:00:00 2001 From: "olau@iola.dk" Date: Wed, 21 Oct 2009 15:49:19 +0000 Subject: [PATCH] Make heuristic for x axis label widths more dynamic (based on patch by rickinhethuis) git-svn-id: https://flot.googlecode.com/svn/trunk@210 1e0a6537-2640-0410-bfb7-f154510ff394 --- NEWS.txt | 2 ++ jquery.flot.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.txt b/NEWS.txt index 343af64..e63b1d9 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -157,6 +157,8 @@ Bug fixes: - Fix for uneven axis margins (report and patch by Paul Kienzle) and snapping to ticks (concurrent report and patch by lifthrasiir). - Fixed bug with slicing in findNearbyItems (patch by zollman). +- Make heuristic for x axis label widths more dynamic (patch by + rickinhethuis). Flot 0.5 -------- diff --git a/jquery.flot.js b/jquery.flot.js index 0c716b2..9c47362 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -620,7 +620,7 @@ // them, we don't need the exact figures and the // fixed-size box content is easy to center if (axis.labelWidth == null) - axis.labelWidth = canvasWidth / 6; + axis.labelWidth = canvasWidth / (axis.ticks.length > 0 ? axis.ticks.length : 1); // measure x label heights if (axis.labelHeight == null) {