Skip to content
New issue

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

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

Already on GitHub? # to your account

Rowchart has Infinite height when _rowData.length is 0 #1008

Closed
nordfjord opened this issue Sep 17, 2015 · 6 comments
Closed

Rowchart has Infinite height when _rowData.length is 0 #1008

nordfjord opened this issue Sep 17, 2015 · 6 comments
Labels
Milestone

Comments

@nordfjord
Copy link

See:

height = (_chart.effectiveHeight() - (n + 1) * _gap) / n;

when you filter such that a rowchart has no rows, its height becomes Infinity, which translates to a lot of errors along the lines of:

Error: Invalid value for <g> attribute transform="translate(NaN,0)"

@gordonwoodhull
Copy link
Contributor

Seems like a legitimate bug, reopening (?)

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Sep 17, 2015
@nordfjord
Copy link
Author

It might be a legitimate bug.

But the errors I was receiving had nothing to do with this, I was way off base.

They were caused by a preRedraw function I had which calculated the xAxis domain and didn't check for infinity/NaN. I haven't seen any errors crop up around the height being Infinity, so I think it should be safe to close.

Regards,

Einar

@alisabzevari
Copy link

I think this is related to a calculation in updateElements function (https://github.com/dc-js/dc.js/blob/develop/src/row-chart.js#L173). This error happened to me:
Invalid negative value for <rect> attribute height="-1.3095238095238095"
It happened when I had too many rows and the chart has a small height. So the calculation made the height of every row to become negative.

@gordonwoodhull
Copy link
Contributor

gordonwoodhull commented Jul 21, 2016

I looked and looked, but couldn't find any way to detect invalid DOM attributes being set in tests? Seems really weird that this can't be tested (via Jasmine). However, I did add a test and verified that it was creating errors before the fix (described in #1024) but not after.

If anyone knows how to test this, I'd really appreciate a hint!

@gordonwoodhull
Copy link
Contributor

@alisabzevari, that's actually a different error - the opposite error. This one has to do with having no rows, not lots of rows.

If you'd care to file a separate issue, I'd appreciate it. Even better with a test case (fiddle or jasmine).

gordonwoodhull added a commit that referenced this issue Jul 22, 2016
and add a test that invokes the error spew of #1008
wish I could observe the errors from Jasmine!!

fixes #1008
closes #1024
@gordonwoodhull
Copy link
Contributor

Fixed in 2.0 beta 32

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants