From aaef39c724ac2eb825c7df6e02a827c45a957de5 Mon Sep 17 00:00:00 2001 From: John Glover Date: Wed, 20 Feb 2013 12:15:43 +0000 Subject: [PATCH] [#324] Show full labels on flot bar y-axis --- src/view.flot.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/view.flot.js b/src/view.flot.js index 834cf63f..70493ff7 100644 --- a/src/view.flot.js +++ b/src/view.flot.js @@ -191,7 +191,7 @@ my.Flot = Backbone.View.extend({ if (typeof label !== 'string') { label = label.toString(); } - if (label.length > 8) { + if (self.state.attributes.graphType !== 'bars' && label.length > 8) { label = label.slice(0, 5) + "..."; } @@ -211,11 +211,15 @@ my.Flot = Backbone.View.extend({ x = 1, i = 0; - while (x <= maxTicks) { - if ((numPoints / x) <= maxTicks) { - break; + // show all ticks in bar graphs + // for other graphs only show up to maxTicks ticks + if (self.state.attributes.graphType !== 'bars') { + while (x <= maxTicks) { + if ((numPoints / x) <= maxTicks) { + break; + } + x = x + 1; } - x = x + 1; } for (i = 0; i < numPoints; i = i + x) {