tag:blogger.com,1999:blog-11300808.post5307614857761809516..comments2024-03-27T04:19:57.377-07:00Comments on The official Google Code blog: Simple Graphics Calculator Using the Visualization API and the ScatterchartMike Marchakhttp://www.blogger.com/profile/08067736591419106914noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-11300808.post-74346643865037309372008-10-01T02:18:00.000-07:002008-10-01T02:18:00.000-07:00@mike chelen: I've posted a modified version of yo...@mike chelen: I've posted a modified version of your live demo at <A HREF="http://nerget.com/google_graph_vis_doofer.html" REL="nofollow">http://nerget.com/google_graph_vis_doofer.html</A><BR/><BR/>My very ad hoc testing shows the function version to be 3-5x faster than calling eval over and over. There are a number of reasons for this. The most obvious is that you don't have to reparse and compile the eval argument over and over again. But other advantages cover things like variable access performance.<BR/><BR/>eg. function(x) { return x*x; } can statically bind both references to x, whereas using eval prevents that by introducing a dynamic scope.<BR/><BR/>Alas even the use of with(Math) harms performance, however by defining the function as:<BR/>with(Math) (function(x){ return ...; }) we can remove the dynamic lookup cost for anything other than actual uses of the Math object.<BR/><BR/>A more performant (albeit memory hungry) approach would be to something akin to:<BR/>var mathStr = "var sin = Math.sin, cos=Math.cos, ...."<BR/>then create the function with "window.eval(mathStr + "(function(x){ return "+equation+";})")<BR/><BR/>Which would result in a static lookup for the Math functions.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11300808.post-22693891255577796242008-09-30T04:18:00.000-07:002008-09-30T04:18:00.000-07:00Math Mechanixs is an easy to use general purpose m...Math Mechanixs is an easy to use general purpose math program. It has a Math Editor worksheet for solving mathematical problems and an extendable Function Library containing over 170 predefined functions with an integrated Function Solver.<BR/>---------------------<BR/>Selleys<BR/><BR/><A HREF="http://www.drivenwide.com" REL="nofollow">forum post</A>Ian smithhttps://www.blogger.com/profile/11587556128819767596noreply@blogger.comtag:blogger.com,1999:blog-11300808.post-45301832617204911852008-09-26T08:06:00.000-07:002008-09-26T08:06:00.000-07:00If I have the following data set: ...If I have the following data set:<BR/><BR/> data.addColumn('string', 'Date'); data.addColumn('number', 'Index');<BR/><BR/> data.setValue(0, 0, dates[0]);<BR/> data.setValue(1, 1, 75.5678);<BR/><BR/> data.setValue(1, 0, dates[1]);<BR/> data.setValue(1, 1, 75.6934);<BR/><BR/> data.setValue(2, 0, dates[2]);<BR/> data.setValue(2, 1, 75.9932);<BR/><BR/> data.setValue(3, 0, dates[3]);<BR/> data.setValue(3, 1, 76.0198);<BR/><BR/> data.setValue(4, 0, dates[4]);<BR/> data.setValue(4, 1, 75.4293);<BR/><BR/>The visualization that is generated whether it is an interactive line<BR/>graph or a plain vanilla line graph is essentially a straight line.<BR/><BR/>Now if I could set the level of "granularity" on the graph so that I<BR/>could actually see the differences in the points plotted, then my<BR/>problem is solved.<BR/><BR/>Or, can I set where the default value is for the y-axis? I searched<BR/>here on the group and it appears I cannot.<BR/><BR/>Any help is greatly appreciated.Joe McCannhttps://www.blogger.com/profile/08357345760436471708noreply@blogger.comtag:blogger.com,1999:blog-11300808.post-12391437491091801132008-09-25T19:55:00.000-07:002008-09-25T19:55:00.000-07:00'with(Math) var y = eval(equation)' is a really b...'with(Math) var y = eval(equation)' is a really bad way to achieve this. A (marginally) better solution would be to do something akin to:<BR/><BR/>var expressionFunction;<BR/>with(Math) expressionFunction = eval("(function(x){"+expression +"})");<BR/><BR/>then replace the later use of "with(Math)eval(expression)" with expressionFunction(x);Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-11300808.post-39871350259942950032008-09-25T19:52:00.000-07:002008-09-25T19:52:00.000-07:00It's been done... http://grapher.greenmangames.vze...It's been done... http://grapher.greenmangames.vze.comAnonymousnoreply@blogger.com