Comment

Comment by grabastic

(I might have missed it in your tutorial, but if not...) It might be worth noting for your readers that attr, style, property and similar methods can accept an object as the argument. Might save people a tiny bit of typing...

    root.selectAll('rect')
            .data(rects).enter()
        .attr({
            x: function (d) { return d.x; },
            y: function (d) { return d.y; },
            width: function (d) { d.w; }
        });
https://github.com/mbostock/d3/pull/277
parent grabastic 14 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton