1

How do I make the x-axis display only integers instead on jqPlot?

Currently it reads:

0.5, 1, 1.5, 2, 2.5, etc.

I want to force it to only display integers in the x-axis labels.

Alasdair
  • 13,348
  • 18
  • 82
  • 138

1 Answers1

8

You might need to specify a format string:

 axes: {
  xaxis: {
    tickOptions: {
      formatString: "%d"
    }
  }
}
Sergiu
  • 2,502
  • 6
  • 35
  • 57
  • Perfect, thank you! It says I can accept your answer in 7 minutes. – Alasdair Mar 29 '13 at 14:37
  • This sort of works. Since it doesn't hide non-whole numbers, only changes their values, a problem arises on axes with a small range. Instead of `0, 0.5, 1.0, 1.5, 2.0...` you will see `0, 1, 1, 2, 2...` – Keith Mar 03 '16 at 17:26