Hi there - I have a script that works to a certain point - It gets a list of specfic columns, assigns these to a list and then uses a combobox to let the user select which column to use for a graph creation. This works fine but the problem is now that when the graph is created it will display outside the window and also appends the new graph - i just need to update the window with the new version.
See the sample script below
// Create the dialog window
win = New Window("Count Analysis by EXPSORTWW_XETA",
V List Box( header_text, Text Box( " " ) ),
VListBox(
PanelBox("Controls",
HListBox(
TextBox("X-axis: EXP_XETA", <<Set Font Style("Bold")),
Spacer Box(size(20, 1)),
TextBox("Overlay Variable:"),
overlayCombo = ComboBox(magicalArray, <<Set Width(200))
)
),
PanelBox("Graph",
gb_test = V List Box() // Container for the graph
)
)
);
// Set change handler
overlayCombo << Set Function(
Function({this},
overlayVar = this << Get Selected;
Show( "Selected: " || overlayVar ); // Debug
updateGraph( overlayVar );
)
);
updateGraph = Function({overlayVar},
// Create new graph if variable is selected
write(overlayVar);
gb = expr(Graph Builder(
Size( 550, 450 ),
Show Control Panel( 0 ),
Variables(
X( :EXPSORTWW_XETA ), // Explicit column reference
Overlay( Column( pc_inline, overlayVar ) )
),
Elements(
Bar( X, Legend(5), Summary Statistic("N"), Bar Style("Stack") )
)
));
// Add the graph to the window
gb_test << Prepend( V List Box( gb ));
// Optional formatting
Report( gb )[FrameBox(1)] <<
Background Color("Light Gray") <<
Transparency(0.2);
);
// Initialize with first variable
If( N Items( magicalArray ) > 0,
overlayCombo << Select( 1 );
updateGraph( magicalArray[1] ); // Force initial graph
);
Could anyone help me out and see what is wrong?