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

y-axis rescale bug #192

Open
aphofstede opened this issue Aug 1, 2013 · 4 comments
Open

y-axis rescale bug #192

aphofstede opened this issue Aug 1, 2013 · 4 comments

Comments

@aphofstede
Copy link

See: http://jsfiddle.net/alexman/vpGyL/844/
If you change the chart height to 99 instead of 100, the y-axis will suddenly show 0-0.8 instead of 0-0.3. This is incorrect.
If you stretch the y-axis by increasing the max-value var a bit, it will be ok again.
A workaround I found is setting an axisystep of 4, however this is not ideal.

@aphofstede
Copy link
Author

axisystep: 4 doesn't always work either; try setting trendline to [0.83,0.81,0.84,0.84,0.82,0.82,0.83,0.84,0.84,0.8,0.82,0.82]

@aphofstede
Copy link
Author

The problem, i think, lies in snapEnds() I think, around line 760. There:

    if (t < to) {
      t = round((to + .5) * Math.pow(10, i)) / Math.pow(10, i);
    }

This will add 0.5 to the calculated max which is 0.8 there; resulting in a value of 1.3

@aphofstede
Copy link
Author

This seems to fix it,

    if (t < to) {
      t = round((to + (.5 / Math.pow(10, i))) * Math.pow(10, i)) / Math.pow(10, i);
    }

    f = round((from - (i > 0 ? 0 : (.5 / Math.pow(10, i)))) * Math.pow(10, i)) / Math.pow(10, i);

but I see more +/-.5 "magic" going on, so perhaps the original coder should have a look.

@xiaohwan
Copy link

xiaohwan commented Aug 7, 2013

I actually removed snapEnds because weird behaviors it causes...or because
it's magic feature I don't know yet.

On Wed, Aug 7, 2013 at 8:04 AM, Alexander Hofstede <[email protected]

wrote:

This seems to fix it,

if (t < to) {
  t = round((to + (.5 / Math.pow(10, i))) * Math.pow(10, i)) / Math.pow(10, i);
}

but I see more +/-.5 "magic" going on, so perhaps the original coder
should have a look.


Reply to this email directly or view it on GitHubhttps://github.com//issues/192#issuecomment-22257737
.

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

2 participants