News for hackers. Stuff that matters.
Re:XKCD-style charts with D3 by jamesaguilar on Thursday October 18, 2012 @08:11PM (#4671697)
If I'm honest, the most impressive thing about this is how much less concise this is than the mathematica version that came out earlier. I wonder if the difference is more a matter of the library quality or the syntax.
Re:XKCD-style charts with D3 by zaptheimpaler on Thursday October 18, 2012 @08:22PM (#4671722)
On the other hand, IMO this looks exactly like an XKCD style graph while all the others (including the mathematica) seemed a little off to me.
Re:XKCD-style charts with D3 by TeMPOraL on Friday October 19, 2012 @02:56AM (#4672564)
I'd say, a little bit too much jitter, especially in text. Some of the versions for Mathematica, et al. were a little bit closer, IMO.
Re:XKCD-style charts with D3 by pygy_ on Friday October 19, 2012 @04:01AM (#4672658)
The text is just a matter of font. The rendering of the graphs look exactly like the original, and that's the hard part.

Edit: as pointed out below, the algorithm was lifted from another version done in Python/Matplotlib by Jake Vanderplas: http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-i...

Re:XKCD-style charts with D3 by pygy_ on Friday October 19, 2012 @06:28AM (#4672942)
The edit window is now closed, but I realised that the font he uses is Humor Sans, which is based on Randal Munroe's handwriting (the author of XKCD).

http://xkcdsucks.blogspot.com/2009/03/xkcdsucks-is-proud-to-...

Re:XKCD-style charts with D3 by richardwhiuk on Friday October 19, 2012 @04:25AM (#4672714)
I'd agree that the font is too much - it's bordering on illegible for me in Chrome 22 on Win 7.
Re:XKCD-style charts with D3 by pygy_ on Friday October 19, 2012 @08:53AM (#4673272)
It is badly hinted and thus badly anti-aliased.
Re:XKCD-style charts with D3 by wladimir on Friday October 19, 2012 @02:09AM (#4672469)
D3js is pretty verbose, but what you get is full control. Most charting libraries allow only a limited amount of configurability, which is neat if you just need to plot a basic chart quickly, but makes them awful if you want to make novel (or at least, more uncommon) kinds of visualisations or make non-standard changes to existing ones.
Re:XKCD-style charts with D3 by primitur on Friday October 19, 2012 @04:19PM (#4675233)
The best thing about this is that it doesn't require me to download and install 1.8 gigabytes of life-sucking Mathematica demo-version just to get a graph that I can draw on a napkin in 4 or 5 seconds ..
Re:XKCD-style charts with D3 by Evbn on Thursday October 18, 2012 @08:54PM (#4671791)
Mathematica has higher level drawing functions.

D3 tends to be more roll your own.

Re:XKCD-style charts with D3 by danso on Thursday October 18, 2012 @09:43PM (#4671933)
It draws a nice sine wave http://so.danwin.com/test/xkcd-d3/
Re:XKCD-style charts with D3 by nigma on Thursday October 18, 2012 @08:37PM (#4671745)
For comparison a version in Python/Matplotlib is at http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-i...
Re:XKCD-style charts with D3 by pwang on Thursday October 18, 2012 @09:24PM (#4671880)
If you look in the source (http://bl.ocks.org/3914862) about 4/5 of the way down, they basically copy the core logic from Jake's Matplotlib version.
Re:XKCD-style charts with D3 by prezjordan on Thursday October 18, 2012 @08:46PM (#4671761)
Nicely presented! And bl.ocks.org is also very clean (never heard of it before).

I would say this is the nicest result I've seen compared to Python, Mathematica, MATLAB.

Re:XKCD-style charts with D3 by jrajav on Thursday October 18, 2012 @09:46PM (#4671938)
You might also like its Markdown soul brother, http://gist.io/
Re:XKCD-style charts with D3 by fourstar on Friday October 19, 2012 @01:25AM (#4672379)
It was created by http://bost.ocks.org/mike/ Mike Bostok. https://github.com/mbostock/bl.ocks.org is the site.
Re:XKCD-style charts with D3 by eric_bullington on Thursday October 18, 2012 @09:28PM (#4671891)
Well done! I actually was planning on tacking this one myself using svg filters but I've been too busy. I didn't see Mike Bostock's comment suggesting the custom line interpolator and wasn't aware of it -- d3 is gaining some cool new functionalities!

Thanks also for the great references. In spite of being a big proponent of d3, I somehow missed the "Toward Reusable Charts" piece Mike wrote earlier this year, which succeeds where I have struggled. I've been using the standard prototypal approach to creating reusable and easily configurable charts, which can be cumbersome for the caller. This functional approach with closures is so much cleaner and more reusable. It's the only way I'll make my d3 charts from now on!

Re:XKCD-style charts with D3 by suprememoocow on Friday October 19, 2012 @04:49AM (#4672751)
If you want to play around with the example, I've stuck it on jsfiddle: http://jsfiddle.net/KndsL/2/
Re:XKCD-style charts with D3 by mark_integerdsv on Friday October 19, 2012 @03:01AM (#4672575)
I still need to see a thorough rationalization for the use of this chart style.

Bonus points for using the Tufte 'lie factor' formula.

Re:XKCD-style charts with D3 by qznc on Friday October 19, 2012 @03:14AM (#4672600)
You want to covney that the graph is not based on measured numbers but only a rough sketch.
Re:XKCD-style charts with D3 by joeblau on Thursday October 18, 2012 @10:04PM (#4671976)
This thing looks amazing. I didn't want to fire up Mathematica to render these charts but I love D3. Thanks!
Re:XKCD-style charts with D3 by gojomo on Friday October 19, 2012 @02:41PM (#4674880)
Now if we could only get D3-style animation in XKCD...
Re:XKCD-style charts with D3 by DanWaterworth on Friday October 19, 2012 @01:35AM (#4672402)
The graph is good, but I think I like the font more.
Re:XKCD-style charts with D3 by riffraff on Friday October 19, 2012 @02:58AM (#4672569)
Re:XKCD-style charts with D3 by vangar on Thursday October 18, 2012 @09:34PM (#4671904)
Can't you just use a tablet and DRAW the graph like it was hand-made?

I don't understand...

Re:XKCD-style charts with D3 by ceejayoz on Thursday October 18, 2012 @10:12PM (#4671996)
For the same reason no one hand-codes the HTML on each individual Hacker News thread?
Re:XKCD-style charts with D3 by bryanh on Thursday October 18, 2012 @09:41PM (#4671924)
Writing code makes repetitive tasks easier: if you want to pump out hundreds or thousands or millions of variations on a graph (using different data, etc...) then drawing it by hand is infeasible.
Re:XKCD-style charts with D3 by unreal37 on Thursday October 18, 2012 @09:42PM (#4671931)
What if the data changes every day?

ie: plotting the number of bugs fixed over time

Re:XKCD-style charts with D3 by sturmeh on Friday October 19, 2012 @09:09AM (#4673348)
Took be a bit to realise this wasn't a Diablo 3 reference.
Re:XKCD-style charts with D3 by gubatron on Thursday October 18, 2012 @09:01PM (#4671815)
" // Compute the distance along the path using a map-reduce." lol
Re:XKCD-style charts with D3 by heeton on Thursday October 18, 2012 @08:38PM (#4671747)
Negative awesomeness?? Uh-oh!
Re:XKCD-style charts with D3 by languagehacker on Thursday October 18, 2012 @08:51PM (#4671778)
Okay, guys. We get it. Enough.