Kevin Gorjan
Kevin Gorjan

Reputation: 1332

Remove comma in jQuery Flot

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

Upvotes: 1

Views: 427

Answers (2)

Martin D
Martin D

Reputation: 1

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

Upvotes: 0

Grim...
Grim...

Reputation: 16953

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'.

Upvotes: 1

Related Questions