76 points · by obilgic · 14y ago · 19 comments
From a question on stackexchange on Mathematica (I think) to basic implementation in HTML5/JavaScript, to a fully functional graph generator that needs no code.
The next evolution I assume can have a jsfiddle like short URLs, share buttons, and a voting mechanism for best graphs.
Ideally I'd like to be able to export the d3 graphs as images, any idea on how to do that?
Which apparently originates from this paper: http://svgopen.org/2010/papers/62-From_SVG_to_Canvas_and_Bac...
EDIT: this seems like a nice approach:
http://stackoverflow.com/questions/4912092/using-html5-canva...
Cool refinement of the existing XKCD work though!
$ string_eval("x*x1")
"x*x1"
I figured that the issue must be with the equation drawing or evaluated. Here's what I found as an inline script (note that i is points at which the function is evaluated): current_expression = expression.split("-x").join(-i);
var result = eval(current_expression.split("x").join(i));
So it just splits up the equation and rejoins it. From here it was pretty easy to see what was happening: $ expression = string_eval("x*x1");
"x*x1"
$ expression.split("x").join(12);
"12*121"
$ expression.split("x").join(3);
"3*31"
$ expression.split("x").join(0.3);
"0.3*0.31"
$ expression.split("x").join(-3);
"-3*-31"Just pushed the bug fix, should work now! Hacker News is awesome, thanks :)