1

I'm working on a project and I need to use some charts. For this project I've chosen to use Flot: http://code.google.com/p/flot/

The problem is, how can I change the x-axis values? From a database I receive the data and parse it to the flot. No problem.

But sometimes I only receive 2 values from the database and the x-axis seems weird.

Instead of: 0, 0.5, 1, 1.5, 2, 2.5, ... I only want 0, 1, 2, 3, ...

Some goes for the y-axis

Thanks

Kevin Gorjan
  • 1,272
  • 1
  • 17
  • 34

2 Answers2

1

I believe the following will set your axis labels:

xaxis: { min: 0, ticks: [[0, 0], [1, 1], [2, 2], [...]], max: 3 }

Search on the docs page for 'Customizing the axes'.

Grim...
  • 16,518
  • 7
  • 45
  • 61
0

I think you could solve it also with this here:

xaxis: { tickDecimals: 0 }

See orginal post: Put only integers in x and y axis of bar and line graphs - Flot

Community
  • 1
  • 1