turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Range slider to control axis range of graph

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 12:15 PM
(1863 views)

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 1:28 PM
(3631 views)

Solution

The easiest way to do this would be to open a Global Data Filter and select the X axis variable as the filter variable. It will set up a slider that will allow you to change the range.

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt:age << modeling type( "continuous" );
gb1 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
gb2 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
dt << Data Filter(
Location( {780, 189} ),
Mode( Show( 1 ), Include( 1 ) ),
Add Filter( columns( :age ) )
);
```

If you want to develop your you can setup a Slider Box to change the Min and Max values of the you can setup something like this:

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt:age << modeling type( "continuous" );
gb1 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
gb2 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
slidervar = Report( gb1 )[axisbox( 1 )] << get min;
slidervar2 = Report( gb1 )[axisbox( 1 )] << get max;
New Window( "Example",
Panel Box( "Slider Box",
H List Box(
sb = Slider Box(
Report( gb1 )[axisbox( 1 )] << get min,
Report( gb1 )[axisbox( 1 )] << get max,
slidervar,
Report( gb1 )[axisbox( 1 )] << Min( slidervar );
Report( gb2 )[axisbox( 1 )] << Min( slidervar );
),
sb2 = Slider Box(
Report( gb1 )[axisbox( 1 )] << get min,
Report( gb1 )[axisbox( 1 )] << get max,
slidervar2,
Report( gb1 )[axisbox( 1 )] << Max( slidervar2 );
Report( gb2 )[axisbox( 1 )] << Max( slidervar2 );
)
)
)
);
```

You can also add a graphics script to each of the Graph Builders, that detects changes in the range and origin of the AxisBox(1), and then when a change is detected, copy the AxisBox(1) settings from the graph where the change is detected, to each of the other graphs. Obviously, this is more complex, however, it does have the advantage of not having to have a separate window with a slider in it.

Jim

6 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 1:28 PM
(3632 views)

The easiest way to do this would be to open a Global Data Filter and select the X axis variable as the filter variable. It will set up a slider that will allow you to change the range.

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt:age << modeling type( "continuous" );
gb1 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
gb2 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
dt << Data Filter(
Location( {780, 189} ),
Mode( Show( 1 ), Include( 1 ) ),
Add Filter( columns( :age ) )
);
```

If you want to develop your you can setup a Slider Box to change the Min and Max values of the you can setup something like this:

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt:age << modeling type( "continuous" );
gb1 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
gb2 = dt << Graph Builder(
Size( 528, 448 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
slidervar = Report( gb1 )[axisbox( 1 )] << get min;
slidervar2 = Report( gb1 )[axisbox( 1 )] << get max;
New Window( "Example",
Panel Box( "Slider Box",
H List Box(
sb = Slider Box(
Report( gb1 )[axisbox( 1 )] << get min,
Report( gb1 )[axisbox( 1 )] << get max,
slidervar,
Report( gb1 )[axisbox( 1 )] << Min( slidervar );
Report( gb2 )[axisbox( 1 )] << Min( slidervar );
),
sb2 = Slider Box(
Report( gb1 )[axisbox( 1 )] << get min,
Report( gb1 )[axisbox( 1 )] << get max,
slidervar2,
Report( gb1 )[axisbox( 1 )] << Max( slidervar2 );
Report( gb2 )[axisbox( 1 )] << Max( slidervar2 );
)
)
)
);
```

You can also add a graphics script to each of the Graph Builders, that detects changes in the range and origin of the AxisBox(1), and then when a change is detected, copy the AxisBox(1) settings from the graph where the change is detected, to each of the other graphs. Obviously, this is more complex, however, it does have the advantage of not having to have a separate window with a slider in it.

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 2:17 PM
(1849 views)

Jim,

but I noticed you individually named all of your graph builder objects.

As I was saying in my question, currently my program works by creating them in a loop so they are not called variable names. Because of this, I don't know how to refer to the Report.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 2:19 PM
(1847 views)

just capture the pointer to each display object into a list, and then you can access each of them by referencing each by going back through the list.

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 2:24 PM
(1845 views)

Okay so I have a function that makes my graphs.

You're saying make an empty list like graphslist = {};

Then in the function,

call the graph builder some variable like a = table << Graph builder();

Then insert into (graphslist, a);

Is this what you mean?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 2:26 PM
(1842 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 19, 2017 2:59 PM
(1839 views)

Awesome! And to get it to be a range slider I did the following:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\big class.jmp" );

dt:age << modeling type( "continuous" );

gb1 = dt << Graph Builder(

Size( 528, 448 ),

Show Control Panel( 0 ),

Variables( X( :age ), Y( :height ) ),

Elements( Points( X, Y, Legend( 5 ) ) )

);

gb2 = dt << Graph Builder(

Size( 528, 448 ),

Show Control Panel( 0 ),

Variables( X( :age ), Y( :weight ) ),

Elements( Points( X, Y, Legend( 5 ) ) )

);

slidervar = Report( gb1 )[axisbox( 1 )] << get min;

slidervar2 = Report( gb1 )[axisbox( 1 )] << get max;

New Window( "Example",

Panel Box( "Slider Box",

H List Box(

rsb = Range Slider Box(

Report( gb1 )[axisbox( 1 )] << get min, Report( gb1 )[axisbox( 1 )] << get max, slidervar, slidervar2,

(

Report( gb1 )[axisbox( 1 )] << Min( slidervar );

Report( gb1 )[axisbox( 1 )] << Max( slidervar2 );

Report( gb2 )[axisbox( 1 )] << Min( slidervar );

Report( gb2 )[axisbox( 1 )] << Max( slidervar2 );

);

)

)

)

);

And with that I was able to do what I needed to for my own script! Jim, thank you so much!