1

I made a bar chart with the Flot library, and used the flot-tooltip plugin to create the tooltips. Alas, while all the tooltip values should be integers, they appear as floats. At first I tried to use parseInt on the actual data passed to Flot, but it didn't help.

Next I tried to use an external function to customize the content of the tooltip, like here: How to set x axis value as tooltip in flot charts textual data

However, the result was an error:

Uncaught TypeError: content.replace is not a function

And after updating flot-tooltip, it changed to:

Uncaught TypeError: a.replace is not a function

I'm using Flot 0.8.3

Did I forget to include some library, or confused the order the scripts should go in? (that can usually generate such errors). Is there another way to force the tooltip values to be integers?

Community
  • 1
  • 1
Ynhockey
  • 3,845
  • 5
  • 33
  • 51

1 Answers1

1

Figured a simple way to do this without an external function:

In the Flot properties, one can add the following:

yaxis: {
            tickDecimals: 0,
        },

This will remove any decimal points from the values.

If anyone knows the reasons for the above errors though, an answer would be appreciated anyway!

Ynhockey
  • 3,845
  • 5
  • 33
  • 51