question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NS_ERROR_FAILURE errors

See original GitHub issue

Hello there,

I keep encountering NS_ERROR_FAILURE errors when using d3-legend. Here’s an Observable notebook, which tries to recreate the Linear Scale Legend - Horizontal example.

I tried to recreate the example outside of an Observable notebook and encountered the same errors. Is it possible that there is an issue with the package?

Thanks in advance,

Iain

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mbostockcommented, Mar 14, 2018

Okay, pretty simple fix:

{
  const svg = d3.select(DOM.svg(width, 40));
  yield svg.node();
  svg.append("g").call(legend);
}

https://beta.observablehq.com/@mbostock/d3-legend

The issue is that d3-svg-legend depends on the SVG node being added to the DOM before you call it, and in Observable, things aren’t added to the DOM until the cell yields or returns. Specifically, you’re using element.getBBox on the text and shape elements generated by the legend, but since the SVG node hasn’t yet been added to the document, the bounding boxes can’t be computed—they are dependent on the styles that the SVG element will inherit, which isn’t known until the SVG element is added to the body.

Probably want you want to do is to have d3-svg-legend through an error if the element that you apply it to isn’t in the DOM. That would be something like this…

svg.each(function() {
  if (!this.ownerDocument.contains(this)) {
    throw new Error("cannot generate legend on detached element");
  }
});
0reactions
jTzipicommented, Jun 11, 2019

Problem solved now. I have to draw chart before displaying on page.

Regards jTzipi

Read more comments on GitHub >

github_iconTop Results From Across the Web

VirtualBox & NS_ERROR_FAILURE error - Dedoimedo
Tutorial showing how to resolve the issue of virtual machines not starting at all in VirtualBox, reflected in a generic NS_ERROR_FAILURE ...
Read more >
VirtualBox error NS_ERROR_FAILURE (0x80004005) on ...
Solution for VirtualBox error NS_ERROR_FAILURE (0x80004005) on macOS which won't allow to launch the virtual machine after updating macOS.
Read more >
VirtualBox NS_ERROR_FAILURE (0x80004005) macOS
This error seems to appear with VirtualBox installs on versions of macOS 10.13. To fix this issue, you have to uninstall VirtualBox (use...
Read more >
Virtualbox does not run: NS_ERROR_FAILURE - Ask Ubuntu
There seems to be nothing wrong with your Virtual Box settings. However the error you see may be related to a previous fail...
Read more >
NS_ERROR_FAILURE (0x80004005) in Windows 10 VM ...
I am getting an error NS_ERROR_FAILURE (0x80004005) in a Windows 10 virtual machine when saving, i.e. not closing down Windows, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found