Re: Keep Slider Consistent With a Slow Graph
- To: mathgroup at smc.vnet.net
- Subject: [mg100168] Re: Keep Slider Consistent With a Slow Graph
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Wed, 27 May 2009 04:05:42 -0400 (EDT)
- References: <gvdqtl$6q1$1@smc.vnet.net>
You could define something to show while your moving the slider, like
this:
plotSlowGraph[xMax_] :=
Module[{x, t},
Plot[NIntegrate[1/((t^2 - 1)*t*Log[t]), {t, x, Infinity}], {x, 2,
xMax}, PlotRange -> All, Frame -> True, Axes -> None]];
plotFastGraph[xMax_] :=
Module[{x, t},
ListLinePlot[
Table[{x,
NIntegrate[1/((t^2 - 1)*t*Log[t]), {t, x, Infinity}]}, {x, 2,
xMax, (xMax - 2)/10}], PlotRange -> All, Frame -> True,
Axes -> None]];
Manipulate[
ControlActive[plotFastGraph[xMax],
plotSlowGraph[xMax]], {{xMax, 10, "x Max"}, 10, 400, 10,
Appearance -> "Labeled"}, ContinuousAction -> True,
SaveDefinitions -> True]
Cheers -- Sjoerd
On May 25, 12:12 pm, bobbail... 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
> ]