Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I work with small values on Y-axis, like 0.00001500 #426

Closed
molotoksoftware opened this issue Mar 22, 2019 · 4 comments
Closed

How can I work with small values on Y-axis, like 0.00001500 #426

molotoksoftware opened this issue Mar 22, 2019 · 4 comments

Comments

@molotoksoftware
Copy link

Hello friends

I have got some problem with the charts.

Data array:
[[1553258700000,["0.00376920","0.00377250","0.00376560","0.00377210"]],[1553259000000,["0.00377210","0.00378620","0.00377180","0.00378140"]],[1553259300000,["0.00378140","0.00378260","0.00377190","0.00378020"]],[1553259600000,["0.00378020","0.00378660","0.00377520","0.00378520"]],[1553259900000,["0.00378500","0.00379520","0.00378290","0.00379490"]],[1553260200000,["0.00379490","0.00379760","0.00377910","0.00378170"]],[1553260500000,["0.00377980","0.00378630","0.00377690","0.00378250"]],[1553260800000,["0.00378260","0.00378450","0.00377110","0.00377970"]],[1553261100000,["0.00377900","0.00379910","0.00377900","0.00379900"]],[1553261400000,["0.00379900","0.00379920","0.00378880","0.00379600"]],[1553261700000,["0.00379590","0.00379680","0.00379080","0.00379340"]],[1553262000000,["0.00379340","0.00380000","0.00379200","0.00379600"]],[1553262300000,["0.00379690","0.00380090","0.00379270","0.00379980"]],[1553262600000,["0.00379900","0.00380240","0.00379200","0.00379210"]],[1553262900000,["0.00379210","0.00379390","0.00375610","0.00376010"]]]

You can see that very small values!

And it looks like this https://i.imgur.com/Qb5iI3I.png

I have tried to change a lot of options.
The last one:
max: 0.0001
forceNiceScale: true
tickAmount: 8
decimalsInFloat: 8

Could somebody help me?

@junedchhipa
Copy link
Contributor

Those are really small values which I didn’t tested for.
I will take a closer look tomorrow ans update this thread.

@molotoksoftware
Copy link
Author

@junedchhipa Thanks

These are usual values for cryptocurrency. This feature will allow to create charts for cryptocurrency courses.

@molotoksoftware
Copy link
Author

Thanks a lot.

But I've found a new problem.

Sometimes a candle goes outside the area.

image

Try this data

[[1553250600000,[0.20419999999999999,0.2051,0.20399999999999999,0.2041]],[1553252400000,[0.2041,0.20419999999999999,0.20349999999999999,0.2039]],[1553254200000,[0.2039,0.20419999999999999,0.20330000000000001,0.20399999999999999]],[1553256000000,[0.2041,0.20549999999999999,0.20349999999999999,0.20480000000000001]],[1553257800000,[0.20469999999999999,0.20519999999999999,0.2031,0.20430000000000001]],[1553259600000,[0.20430000000000001,0.20569999999999999,0.2039,0.20469999999999999]],[1553261400000,[0.2046,0.20530000000000001,0.20369999999999999,0.20369999999999999]],[1553263200000,[0.20369999999999999,0.2049,0.20230000000000001,0.2044]],[1553265000000,[0.2044,0.20549999999999999,0.2039,0.2051]],[1553266800000,[0.20499999999999999,0.20699999999999999,0.20469999999999999,0.20680000000000001]],[1553268600000,[0.20680000000000001,0.20730000000000001,0.2059,0.20710000000000001]],[1553270400000,[0.20710000000000001,0.20860000000000001,0.2056,0.20699999999999999]],[1553272200000,[0.20699999999999999,0.2072,0.20630000000000001,0.20699999999999999]],[1553274000000,[0.2069,0.20830000000000001,0.20660000000000001,0.20780000000000001]],[1553275800000,[0.20780000000000001,0.20830000000000001,0.2069,0.2072]],[1553277600000,[0.2072,0.2074,0.20660000000000001,0.2069]],[1553279400000,[0.20699999999999999,0.20710000000000001,0.20619999999999999,0.20619999999999999]],[1553281200000,[0.20630000000000001,0.2072,0.20580000000000001,0.20649999999999999]],[1553283000000,[0.20660000000000001,0.20699999999999999,0.20549999999999999,0.20630000000000001]],[1553284800000,[0.20619999999999999,0.20669999999999999,0.20569999999999999,0.20660000000000001]],[1553286600000,[0.2064,0.2074,0.20599999999999999,0.20699999999999999]],[1553288400000,[0.20699999999999999,0.20799999999999999,0.20649999999999999,0.2072]],[1553290200000,[0.20699999999999999,0.20730000000000001,0.20599999999999999,0.20630000000000001]],[1553292000000,[0.20630000000000001,0.2069,0.2054,0.2059]],[1553293800000,[0.2059,0.20619999999999999,0.20519999999999999,0.20599999999999999]],[1553295600000,[0.20610000000000001,0.20630000000000001,0.20530000000000001,0.20549999999999999]],[1553297400000,[0.2054,0.2064,0.2054,0.2054]],[1553299200000,[0.2054,0.2059,0.2026,0.20280000000000001]],[1553301000000,[0.20280000000000001,0.2039,0.20250000000000001,0.20349999999999999]],[1553302800000,[0.2036,0.20399999999999999,0.20300000000000001,0.20349999999999999]],[1553304600000,[0.20369999999999999,0.20530000000000001,0.20349999999999999,0.20469999999999999]],[1553306400000,[0.20480000000000001,0.20519999999999999,0.20399999999999999,0.20499999999999999]],[1553308200000,[0.20519999999999999,0.20530000000000001,0.2031,0.2034]],[1553310000000,[0.2034,0.20369999999999999,0.19589999999999999,0.19989999999999999]],[1553311800000,[0.1996,0.20119999999999999,0.19839999999999999,0.20080000000000001]],[1553313600000,[0.20080000000000001,0.20200000000000001,0.19980000000000001,0.20080000000000001]],[1553315400000,[0.20100000000000001,0.20150000000000001,0.19939999999999999,0.2001]],[1553317200000,[0.20019999999999999,0.20130000000000001,0.19989999999999999,0.20119999999999999]],[1553319000000,[0.20119999999999999,0.20280000000000001,0.2011,0.20230000000000001]],[1553320800000,[0.20219999999999999,0.2024,0.19969999999999999,0.2011]],[1553322600000,[0.2011,0.20300000000000001,0.20080000000000001,0.2024]],[1553324400000,[0.2024,0.2026,0.2011,0.2016]],[1553326200000,[0.2019,0.20280000000000001,0.2016,0.2026]],[1553328000000,[0.2026,0.20300000000000001,0.20219999999999999,0.2024]],[1553329800000,[0.2024,0.2026,0.2019,0.20250000000000001]],[1553331600000,[0.20250000000000001,0.2026,0.2016,0.2016]],[1553333400000,[0.2016,0.20200000000000001,0.2014,0.2019]],[1553335200000,[0.2019,0.20200000000000001,0.19850000000000001,0.20069999999999999]],[1553337000000,[0.2006,0.2014,0.20000000000000001,0.20130000000000001]],[1553338800000,[0.20130000000000001,0.20130000000000001,0.2011,0.20130000000000001]]]

@uranum
Copy link

uranum commented Apr 27, 2019

the same problem on other graph Area Charts > Datetime X-Axis

my data:
[[1551225600000,2.9e-7],[1551312000000,2.9e-7],[1551398400000,2.8e-7],[1551484800000,3e-7],[1551571200000,2.8e-7],[1551657600000,2.7e-7],[1551744000000,2.8e-7],[1551830400000,2.7e-7],[1551916800000,2.7e-7],[1552003200000,2.7e-7],[1552089600000,2.8e-7],[1552176000000,2.9e-7],[1552262400000,2.7e-7],[1552348800000,2.7e-7],[1552435200000,2.8e-7],[1552521600000,2.8e-7],[1552608000000,3e-7],[1552694400000,3.1e-7],[1552780800000,2.9e-7],[1552867200000,2.9e-7],[1552953600000,2.9e-7],[1553040000000,3.1e-7],[1553126400000,3e-7],[1553212800000,3e-7],[1553299200000,2.9e-7],[1553385600000,2.9e-7],[1553472000000,2.8e-7],[1553558400000,2.8e-7],[1553644800000,2.8e-7],[1553731200000,2.9e-7],[1553817600000,2.8e-7],[1553904000000,2.9e-7],[1553990400000,2.8e-7],[1554076800000,2.8e-7],[1554163200000,2.5e-7],[1554249600000,2.5e-7],[1554336000000,2.6e-7],[1554422400000,2.7e-7],[1554508800000,2.6e-7],[1554595200000,2.5e-7],[1554681600000,2.5e-7],[1554768000000,2.6e-7],[1554854400000,2.4e-7],[1554940800000,2.5e-7],[1555027200000,2.4e-7],[1555113600000,2.5e-7],[1555200000000,2.5e-7],[1555286400000,2.5e-7],[1555372800000,2.6e-7],[1555459200000,2.9e-7],[1555545600000,2.8e-7],[1555632000000,2.6e-7],[1555718400000,2.8e-7],[1555804800000,2.7e-7],[1555891200000,2.6e-7],[1555977600000,2.4e-7],[1556064000000,2.3e-7],[1556150400000,2.3e-7],[1556236800000,2.4e-7],[1556323200000,2.4e-7]]

rocso added a commit to rocso/apexcharts.js that referenced this issue Jan 13, 2024
rocso added a commit to rocso/apexcharts.js that referenced this issue Jan 17, 2024
rosco54 pushed a commit to rosco54/apexcharts.js that referenced this issue Feb 10, 2024
early due to cumulative precision errors in JS float representations.
This is also the root cause of issue apexcharts#430, allowing the
removal of the previous fix.

Add NetBeans IDE config and ignore private resources.

Exclude line and area chart from +/-5% range expansion that is applied
to accommodate box and candlestick elements.

Remove the unnecessary range expansion because the cited issue apexcharts#426 looks
fine without it.

Remove code from previous fixes for the following issues, as the
examples provided with those issues display correctly with recent
commits:

Previous fix for issue apexcharts#492 is obsolete, possibly following
commit #4562468 that fixed cases where the Y axis missed including the
uppermost tick due to JS precision errors.

NetBeans config, including to allow node.js builds from within NB.

If the user defines options that are consistent amongst themselves,
don't adjust them, apply them as-is.

In computing the provisional nice step size, set magMsd to integer
subdivisions of 10, i.e. magPow*[1,2,5,10], eliminating ugly values
that are magPow*[3,4,6,7,8,9]. This can be overridden by setting
stepSize and setting forceNiceScale: true.
If the given stepSize is bigger than the range, or
impractically small and resulting in excessive ticks, apply it
after normalizing it the chart order of magnitude and checking
again for consistency.
E.g. if the range = 0.4 and user sets stepSize: 8 (or 8000 or 0.0008),
then stepSize is obviously disproportionate and impractical.
Normalize it to 0.08 or 0.008 depending on tickAmount etc.

Root Cause Fix: getminYmaxY() not determining chart min and max according to
series type, thus returning incorrect values.
For example, e2e test "candlestick/candlestick-line.html" has
chart.type "line" while the two series' have types "line" and
"candlestick" respectively. The candlestick data min/max was being
determined as for a "line" series.

Modified unit tests:
Brought into line with changes introduced in the current branch
to prevent trivial failure reports.

New sample to verify duplicate label removal by formatter.

All working except for brush-charts, which are experimental and
don't call niceScale yet.

Add utility functions:
	getGCD() - return GCD of two numbers (not used in this version)
	getPrimeFactors() - return all prime factors of an integer
	mod() - a mod b: to overcome precision errors

Reduce ticks nicely as chart size is reduced, if options allow.

Multi series/multi yaxis charts: attempt to use consistent tickAmounts
so they line up. Per series options override may override this.

Adjust some tickAmount values in e2e samples now that users should
expect to see that many ticks.

Set default ticks back to 10.
A default of 5 has the following undesirable effects:
Most charts work with base 10 numbers, and 10/5=2, which tends to
produce tick spacings of 0.2, 2, 20, etc. This tends to visually bunch
graphs toward the centre of the axis range, leaving more of the chart
area unused. Having 10 as the default reverses this tendency, bringing
data points closer to the extremities of the range.

defaults.js: remove the default tickAmount = 6 for polarArea charts. Let niceScale
determine it if not user defined.

radar-with-polygom-fill.xml: remove user defined tickAmount = 7. Let
niceScale() determine it, otherwise 7 ticks are what will be drawn,
which will produce a sub-optimal chart for the sample data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants