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

Weird rendering issue for Line charts #168

Closed
adampope opened this issue Jan 24, 2013 · 3 comments
Closed

Weird rendering issue for Line charts #168

adampope opened this issue Jan 24, 2013 · 3 comments

Comments

@adampope
Copy link

I have a line chart with data

[{y: "2012", a: 4.5},{y: "2011", a: 3.66}, {y: "2010", a: 4.2}, {y: "2009", a: 4.1}, {y: "2008", a: 3.8}, {y: "2007", a: 4.4},{y: "2006", a: 3.2}]

and options

xkey: "y",
ykeys: ["a"],
labels: ["Series A"],
hideHover: true,
ymax: 5,
ymin: 0

When I render the graph, I have no 2 on my Y-axis and the grid line is missing

Screen Shot 2013-01-24 at 09 18 43

I've tried with the graph at different sizes and the problem persists.

If I change the ymax to 6 I lose both number 2 and 4.

Screen Shot 2013-01-24 at 09 25 12

max 5 / min 1 works but max 6 / min 1 loses number 3.

I've tried with the released version 0.3.3 and the version from Github.

@adampope
Copy link
Author

I think the error is in Morris.Grid at line 182

@yInterval = (@ymax - @ymin) / (@options.numLines - 1)
if @yInterval > 0 and @yInterval < 1
    @precision =  -Math.floor(Math.log(@yInterval) / Math.log(10))
else
    @precision = 0

setting the numLines options to 6 manually worked for me.

I've see the default for numLines is 5, that seems quite arbitrary and causes significant problems in this case!

@oesmith
Copy link
Contributor

oesmith commented Jan 25, 2013

There's definitely scope to improve the Y-axis labelling code. Right now it's very naive, and I think I can do better.

Watch this space.

@oesmith
Copy link
Contributor

oesmith commented Jan 25, 2013

Closing this as a dupe of #162. It's not exactly the same problem, but we should fix both at the same time.

@oesmith oesmith closed this as completed Jan 25, 2013
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