sibasishm
sibasishm

Reputation: 442

C3.js Hide tooltip when value is 0

So I am using C3 to create a line chart which looks like this: enter image description here

Now I have to hide the tooltip when the value on the chart is zero. I can't find any solutions online or on the documentation of C3.

Please help. Thank you.

Upvotes: 1

Views: 616

Answers (1)

Diego
Diego

Reputation: 192

You can modify the tooltip.contents function for that. It modifies the HTML of the tooltip according to your needs.

According to the docs:

tooltip.contents

Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show. If tooltip.grouped is true, data includes multiple data points.

The documentation explains it clearly here: C3 Docs - Tooltip Contents

You can see an example on this fiddle I made: JSFiddle

Hope I could help!

Upvotes: 1

Related Questions