Re: Keep Slider Consistent With a Slow Graph
- To: mathgroup at smc.vnet.net
- Subject: [mg100170] Re: Keep Slider Consistent With a Slow Graph
- From: dh <dh at metrohm.com>
- Date: Wed, 27 May 2009 04:06:05 -0400 (EDT)
- References: <gvdqtl$6q1$1@smc.vnet.net>
Hi, a possible solution is to disable the slider during graphic computations: ========================== ffl = True; Manipulate[(ffl = False; t = plotSlowGraph[xMax]; ffl = True; t), {{xMax, 10, "x Max"}, 10, 400, 10, Appearance -> "Labeled", Enabled -> Dynamic@ffl}, ContinuousAction -> False, SaveDefinitions -> True] ============================ Daniel bobbaillie at frii.com wrote: > The graph displayed by the Manipulate below takes a while to display. > While the calculation is taking place, if you click on some other > value on the slider, the slider moves and displays its new value. > However, the graph will plot using the original value. > > The result is that the graph and the slider are now out of sync. This > is bad user interface design. > > In the real example I am working with, there is no way to make the > calculations go fast enough to keep up with clicks on the slider. For > the same reason, I cannot allow the user to slide the slider, so > ContinuousAction must be False. > > Nevertheless, is there some way to make sure the slider and the graph > stay consistent with each other? > > Robert Baillie > > plotSlowGraph[xMax_] := > Module[ > { x, t }, > Plot[ NIntegrate[1/((t^2 - 1)*t*Log[t]), > {t, x, Infinity}], {x, 2, xMax} ] > ]; > > Manipulate[ > Graphics[ plotSlowGraph[xMax] ], > { {xMax, 10, "x Max"}, 10, 400, 10, Appearance -> "Labeled" }, > ContinuousAction -> False, SaveDefinitions->True > ] >