I'm not saying I can't figure it out from the code, I can. But still a "what is D3" section would help.
The site looks like a really nice mix of prose explanation and code examples. And D3 looks very intriguing whatever it is. OK I'm off to Google now.
I think he's targeting his audience well. I'd imagine most of his users arrive like this...
1) I need a data visualization library.
2) D3 seems to be a good one.
3) Read the D3 docs at the project's homepage.
4) I still need help learning D3.
5) Google for tutorials.
6) End up at this person's tutorial.
"What is D3" would make sense if users did this in reverse (like I'm sure some people clicking on this news item have done), but I don't think that's the normal use case and I don't blame the author for not addressing it.For these reasons, I hold that any piece of technical writing needs an introduction, no matter how familiar the intended audience is. It doesn't need to be long. But it does need to have its place (at the beginning).
HOWEVER! Either we all overlooked this: http://code.hazzens.com/d3tut/lesson_0.html (because this article links straight to lesson one) or the author has added an introduction in the mean time, because it does have an introduction :) So, all is good :)
(BTW I thought that D3 also brought a 3D framework to the canvas, but I see no mention of that anywhere--maybe I"m confused with the name and something else?)
d3.selectAll('div')
.text(function() {
var index = Array.prototype.indexOf.call(this.parentElement.children, this);
return (index % 2) == 0 ? 'Even' : 'Odd';
});
No need for calculating the index variable - it's already provided as the second argument of the function passed to the text() method: d3.selectAll('div')
.text(function(d, index) {
return (index % 2) == 0 ? 'Even' : 'Odd';
}); 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/277What are the best open-source charting libraries available right now (in terms of looks)? D3 or not, although I'll prefer D3, as it would be easier to extend.
I'm looking for something as pretty as Highcharts, to use in open-source apps.
I'm trying to choose which to use for a project, and I can't find much reason to prefer one over the other.
However, once you dive a bit deeper with selections and nesting, there are some things that are not immediately obvious how to structure. For example, when we implemented small multiple visualization, figuring out the best way to structure enter and update sets for nested data took a few attempts.
Sadly, getting around to properly explaining them will take another lesson or two.
This is another must-read: http://bost.ocks.org/mike/join/
[0] http://stackoverflow.com/questions/12719486/d3-js-graphs-out...
More informative titles help people unfamiliar with great tools (such as d3.js - an outstanding JavaScript lib for manipulating documents; see d3js.org) get to know about these tools.