Giter Club home page Giter Club logo

Comments (7)

mbostock avatar mbostock commented on May 14, 2024

I’ll investigate, but a word of caution: as the README says, this module is currently an experimental API and is likely to change before 4.0 is released. This module and d3-transition are likely to be the last of the 4.0 modules to be released (since, in some sense, they are the most important to get the API right). So I wouldn’t recommend using this module in production yet.

I am working on implementing the other modules first, so I can’t be as responsive fixing issues in the unreleased modules such as this one.

That said, it is a bug if the code is trying to set the length of a NodeList, clearly. It should have arrayify’d the arrays first before mutating them.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Also, it looks like you’re trying to call selection.text on the enter selection before appending. That shouldn’t fail, but it also won’t have any effect because you’re setting the textContent property of a placeholder node. You’ll want to say something like this instead:

selectAll('p')
    .data(data)
  .enter().append('p')
    .text(d => d)

from d3-selection.

akre54 avatar akre54 commented on May 14, 2024

Sure thing, this isn't a production app, so no damage there. The new stuff is too tempting to leave alone though :)

Also, the example was thrown together, that's not app code, the failure is coming in data, before it even hits the enter section but I'll fix the example.

As far as I can tell, the enter and exit calls are arryifying the selection around emptyNode, but the update call is simply this._root, which is a NodeList.

I'm really looking forward to using this stuff in production, happy to help bugbash if that's in the cards.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Cool, just making sure. Another gotcha in your test case (probably unrelated to the bug) is that you didn’t select a node to append to, so your entering paragraph elements will get added to the document element rather than the body. The fix:

select('body').selectAll('p')
    .data(data)
  .enter().append('p')
    .text(d => d);

from d3-selection.

akre54 avatar akre54 commented on May 14, 2024

Ah. Yeah in the app its a normal selection on a group of bar charts (similar to the crossfilter example). Works right if I leave d3.selectAll in there.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

The bug is only exhibited when calling selection.data on a top-level (flat) selection, rather than one nested under a parent element. That typically never happens because you instead specify a parent to append to. But it shouldn’t fail. Fix incoming.

from d3-selection.

akre54 avatar akre54 commented on May 14, 2024

from d3-selection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.