Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Vertical grid lines not displaying when tick labels are rotated. #11

Open
dshenderson opened this issue Jun 26, 2014 · 5 comments
Open

Comments

@dshenderson
Copy link

When labels are rotated, the vertical grid lines for the ticks are not rendered on the chart. I believe this is because of opts.ticks = []; on line 77.

@dshenderson
Copy link
Author

Since the original ticks are preserved in xaxis.rotatedTicks = ticks; on line 76, wouldn't it be possible to patch flot to check for the existence of xaxis.rotatedTicks in order to draw the vertical lines?

@dshenderson
Copy link
Author

I have patched my copy flot as follows, which seems to take care of the issue:

/jquery.flot.js
Index: assets/javascript/lib/jquery/plugins/flot/jquery.flot.js
===================================================================
--- assets/javascript/lib/jquery/plugins/flot/jquery.flot.js    (revision 13829)
+++ assets/javascript/lib/jquery/plugins/flot/jquery.flot.js    (working copy)
@@ -2030,8 +2030,9 @@

             for (var j = 0; j < axes.length; ++j) {
                 var axis = axes[j], box = axis.box,
-                    t = axis.tickLength, x, y, xoff, yoff;
-                if (!axis.show || axis.ticks.length == 0)
+                    t = axis.tickLength, x, y, xoff, yoff,
+                    rTicks = axis.rotatedTicks || axis.ticks;
+                if (!axis.show || rTicks.length == 0)
                     continue;

                 ctx.lineWidth = 1;
@@ -2080,8 +2081,8 @@
                 ctx.strokeStyle = axis.options.tickColor;

                 ctx.beginPath();
-                for (i = 0; i < axis.ticks.length; ++i) {
-                    var v = axis.ticks[i].v;
+                for (i = 0; i < rTicks.length; ++i) {
+                    var v = rTicks[i].v;

                     xoff = yoff = 0;`

@PlippiePlop
Copy link

Seems to fix the issue.

@waldofe
Copy link

waldofe commented May 10, 2016

+1 also worked for me.

@hobwell
Copy link

hobwell commented May 17, 2018

+1 still works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants