Comments (4)
By setting max: 0.11 and min: -0.1, you set the range (0.21), and this must be divided into even spacings. So you get either 7 divisions of 0.03 (most likely) or 3 divisions of 0.07 (unlikely), and neither of those land on zero.
You could try the following:
max: 0.12,
min: -0.1
which is guaranteed to produce divisions that land on zero (range 0.22 = 11 divisions of 0.02 spacing, or
max: 0.12,
min: -0.12,
which is almost guaranteed to land on zero.
PS. This is not a bug. The documentation needs to be updated but even in it's current form doesn't imply that it will guarantee a zero tick. As of 3.46.0, user options are honored if self-consistent but an option will be tweaked or ignored if it's in conflict with other user-defined options. Min and/or max are always honored, then stepSize and tickAmount, in roughly that order of priority. For example, setting min: 0, max: 10 and stepSize: 3 is in conflict, so stepSize would be tweaked to fit. ForceNiceScale is used to choose between various alternative outcomes under certain conditions.
from apexcharts.js.
@rosco54 Thanks a lot for your quick answer! These infos will sure help me out a lot trying to figure this out. I tried tweaking my code a little bit more and noticed that even when nor min or max are passed, some of my charts with small values still don't land on 0. Do you think it would be a nice feature to have some way of forcing the 0 to show up? I think it would make some charts a lot easier to read. In this case i misstagged my issue and I apologize, it should have been a feature request. But still, do you think that would be possible?
I think it would be a lot more friendly if that existed instead of having to add extra complexity on my code to do these kinds of maths to have a chance that it might land on 0
from apexcharts.js.
Yes, it would be nice, and the unrestricted auto scaling generally does that. Indirectly though, as a side effect of how it does the scaling, so it's not 100% guaranteed even when no user-defined options are present. The solution in that case, may be to increase the margin space on the chart area so that you don't have to try to make allowance for it using min or max settings.
from apexcharts.js.
@ehbats Would you be able to add one of those "charts with small values [that] still don't land on 0" to this issue? One of those that don't include min or max. I would like to see how that is happening and I can't seem to conjure up an example of my own that doesn't land on zero.
from apexcharts.js.
Related Issues (20)
- Wrong hours on x-axis labels when Daylight Saving Time changes
- Touch support for onMouseMove event Broken HOT 1
- Option yaxis.labels.formatter is not updated when options prop changes HOT 2
- First line value stacked on multiple y axis graph ( bar + line ) HOT 1
- [NPM] No 3.49.0 package
- DOCS - mixed charts > multiple Y-axis sample not showing HOT 2
- Additional notes to csv file
- Markers and axis line
- Combo chart columnWidth:100% appears with large gaps when zoomed in
- Animation wrong when updating series (3.48 worked, 3.49 not working) HOT 3
- yaxis labels duplicated with a formatter function
- Zoom is broken if x-axis range is set HOT 2
- Radar chart x-axis labels get cut off on small screens(mobile) HOT 1
- Firefox bug since 124.0.1 HOT 1
- Support Border Radius for Donut, Pie and Polar Area Charts HOT 1
- Stacked charts are not displayed correctly if there are several series
- Mixed charts (column & line) not working. HOT 2
- Can add icon or help text to explain the charts
- apexcharts.common.js:6 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'group') HOT 10
- First Item of Bar Chart Does Not Appear for Certain Widths When Border Radius is Enabled HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apexcharts.js.