I'm displaying a radio box and a graph in a "new window". If the user selects a different graph in the radio box I want the old graph deleted and the new graph displayed, all in the same window. Not sure how exactly to do this. Here's a simple example that displays the first chart.
dt = open("$sample_data\Big Class.jmp");
my_1_script = expr(
my_gb = Graph Builder(
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 3 ) ) )
);
);
my_2_script = expr(
my_gb = Graph Builder(
Show Control Panel( 0 ),
Variables( X( :sex ), Y( :age ) ),
Elements( Histogram( X, Y, Legend( 5 ) ) )
);
);
my_3_script = expr(
my_gb = Graph Builder(
Show Control Panel( 0 ),
Variables( X( :age ), Y( :age ) ),
Elements(
Pie( X, Y, Legend( 2 ), Pie Style( "Pie" ),
Summary Statistic( "Mean" ), Label( "No Labels" )
)
)
);
);
chart_list = {"Chart 1", "Chart 2", "Chart 3"};
//------------------------------------------------------------------------------
my_win = new window("Chart Display",
panelbox("Graph Options",
hlistbox(
panelbox("Select Chart",
chart_rb = radiobox(chart_list,
selected_chart = chart_rb << get selected;
if (selected_chart == "Chart 1",
my_1_script,
selected_chart == "Chart 2",
my_2_script,
selected_chart == "Chart 3",
my_3_script
)
)
),
)
),
// Default is chart 1
my_1_script
);