question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poor handling for non-integer values on the y-axis

See original GitHub issue

When making charts that have float/decimal values, the values always round. This makes it extremely annoying for plotting data under 1. Right now I have a workaround so that I can see the actual value on hover by setting the formatter like:

options.yaxis.labels.formatter = val => val.toFixed(2)

However there doesn’t seem a way to get any non integer ticks to show up. Therefore if all data is between 0 and 1, you’ll only be able to see two ticks: 0 and 1.

P.S. Thanks for the great library! A lot easier to use than chart.js for simple stuff.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
junedchhipacommented, Aug 3, 2018

Updated the “fraction/decimal” part to allow the user to give a default value. Currently, the default is set to 2 - https://github.com/apexcharts/apexcharts.js/commit/b37f2490f28bd1d41f95ec14c4b6bfafb91a76a4 The option can be set at options.yaxis.decimalsInFloat Need to add in the docs

3reactions
junedchhipacommented, Aug 2, 2018

@MichaelDanielTom Removed the condition where smaller values were generating no ticks / single tick on y-axis. Now, You can control the number of ticks that can be generated by this option

options.yaxis.tickAmount = 6

However, the way you have handled the float values by .toFixed(2) is required for now. I will check whether the series contains float numbers and based on that - decide whether to round off or not.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show only integer values on yAxis of HighChart?
These can only be integers. When we display data that has a high enough yValue the yAxis labels are integers. However, when we...
Read more >
Force bar chart Y axis scale to be integer-only
I have a bar chart that shows a count of items, by category. When the counts are small, the axis tickmark values show...
Read more >
[R] suppressing non-integer labels for plot x-axis
[R] suppressing non-integer labels for plot x-axis ... difficulty making R plot only integer labels on the x-axis > of a simple graph....
Read more >
Axis not displaying integers - pgfplots - LaTeX Stack Exchange
I've built a plot using PGFPlots where I've told it to display axis numbers every 10 units and for some reason instead of...
Read more >
Handling Missing Data | Python Data Science Handbook
There are a number of schemes that have been developed to indicate the presence of ... Common special values like NaN are not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found