Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Flot, is it possible to eliminate or hide grid ticks without eliminating the corresponding label?

The Flot API documentation describes the library's extensive hooks for customizing the axes of a graph. You can set the number of ticks, their color, etc. separately for each axis. However, I can not figure out how to prevent Flot from drawing the vertical grid lines without also removing the x-axis labels. I've tried changing the tickColor, ticks, and tickSize options with no success.

I want to create beautiful, Tufte-compatible graphs such as these:

http://www.robgoodlatte.com/wp-content/uploads/2007/05/tufte_mint.gif http://www.argmax.com/mt_blog/archive/RealGDP_graph.jpg

I find the vertical ticks on my graphs to be chart junk. I am working with a time series that I am displaying as vertical bars so the vertical ticks often cut through the bars in a way that is visually noisy.

like image 666
Greg Borenstein Avatar asked Oct 04 '08 07:10

Greg Borenstein


1 Answers

As Laurimann noted, Flot continues to evolve. The ability to control this has been added to the API (as noted in the flot issue Nelson linked to).

If you download the latest version (which is still labeled 0.6), you can disable lines on an axis with "tickLength", like so:

xaxis: {
  tickLength: 0
}

Rather annoyingly, this addition hasn't been updated in the API documentation.

like image 82
Darren Avatar answered Sep 22 '22 05:09

Darren