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

[Exception] Uncaught DOMException: Failed to read the 'value' property from 'SVGLength' #19

Open
eitanfr opened this issue Oct 10, 2018 · 8 comments

Comments

@eitanfr
Copy link

eitanfr commented Oct 10, 2018

hi,
getting this exception after passing data to force-horse, I am passing data a number of times in a second - I guess it causes the issue:

the exception:

Uncaught DOMException: Failed to read the 'value' property from 'SVGLength': Could not resolve relative length.
    at SVGSVGElement.defaultExtent (http://localhost:3000/webpack-internal:///2894:29:25)
    at new Gesture (http://localhost:3000/webpack-internal:///2894:198:26)
    at gesture (http://localhost:3000/webpack-internal:///2894:190:12)
    at SVGSVGElement.eval (http://localhost:3000/webpack-internal:///2894:164:40)
@AmitMY
Copy link
Contributor

AmitMY commented Oct 10, 2018

Reproduction:

@ramtob
Copy link
Member

ramtob commented Oct 14, 2018

There is an similar issue open on d3-timer (same error message)

d3/d3-timer#32

This could be the source of our issue too.

@ramtob
Copy link
Member

ramtob commented Oct 14, 2018

Above a certain number of nodes (default = 420), Force horse operates a requestAnimationFrame() call of its own. I thought the problem could be related to this. But I see that the problem happens also for e.g. 200 nodes. So the root problem still seems to be inside d3.js.

@LiorSaadon
Copy link

same here, did anyone find a solution?

@eitanfr
Copy link
Author

eitanfr commented Jan 3, 2019

I am doing debounce

@sarbull
Copy link

sarbull commented Apr 26, 2021

adding .extent([0, 0], [300, 300]); fixed my issue.

this.zoom =
  d3.zoom()
      .extent([[0,0],[300,300]])
      .on('zoom', this.zooming);

i don't know why it's working 🥇

@wjentner
Copy link

I stumbled over this when searching for the error message, and it provided the correct hint.

The Readme for zoom.extent states:
"If extent is not specified, returns the current extent accessor, which defaults to [[0, 0], [width, height]] where width is the client width of the element and height is its client height; for SVG elements, the nearest ancestor SVG element’s viewBox, or width and height attributes, are used. Alternatively, consider using element.getBoundingClientRect."

see: https://github.com/d3/d3-zoom/blob/main/README.md#zoom_extent

For me, the error was shown because the SVG was loaded in a different tab and this possibly causes the width/height to be 0.

@jackytv12
Copy link

adding .extent([0, 0], [300, 300]); fixed my issue.

this.zoom =
  d3.zoom()
      .extent([[0,0],[300,300]])
      .on('zoom', this.zooming);

i don't know why it's working 🥇

saved my life

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

7 participants