3
$\begingroup$

Let lower and upper be fixed constants, with lower < upper.

Now, suppose that x, y, and z represent any numbers that satisfy these constraints:

$lower \leq x < y < z \leq upper$

I'm looking for a way to represent such numbers x, y, and z in a Manipulate widget.

The ideal solution would be a single slider over the range [lower, upper], and having three knobs, one for each of x, y, and z, such that each knob is free to slide over the sub-interval defined by the neighboring sliders and the bounds lower and upper.

The IntervalSlider control gets me almost there, but it has only two knobs.

Does anyone know how to do this?

$\endgroup$
5
$\begingroup$

How about using a different object to control some variables? It's not exactly a Manipulate control but it can have the same effect:

HorizontalGauge[Dynamic@{x, y, z}, {0, 100}]

Gauge

I haven't worked out the constraining of variables but this could be a useful start.

$\endgroup$
  • 3
    $\begingroup$ How about: Column[ { HorizontalGauge[Dynamic[{x, y, z}, Function[{val}, {x, y, z} = Sort[val] ] ], {0, 100} ], Dynamic[{x, y, z}]} ] $\endgroup$ – Sjoerd Smit Dec 16 '16 at 16:56
4
$\begingroup$

A teeny modification to Smit's solution, to fit the requirements of the question:

With[{lower = 0, higher = 1},
 Column[
  {HorizontalGauge[Dynamic[{x, y, z}, 
     Function[{val}, {x, y, z} = Sort[val]]], {lower, higher},
     ImageSize -> 400], 
   Dynamic[{x, y, z}]}]
 ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.