Range slider to control axis range of graphA loop generates several graph builders with no particular name. I wanted to make a range slider to allow me to change the X axis range of ALL graphs in the journal (which all have the same range) but I'm not sure how to do that.
Re: Range slider to control axis range of graphAwesome! 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!
Re: Range slider to control axis range of graphYou got it.
Re: Range slider to control axis range of graphOkay 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?
Re: Range slider to control axis range of graphjust 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.
Re: Range slider to control axis range of graphJim,
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.
Re: Range slider to control axis range of graphThe 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.