When I build a graph from a dt like this:
gb = Data_Table << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Split ),
X( :Wafer, Position( 1 ) ),
Y( As Column( analysisTests[i] ) ),
Color( :Split )
),
Elements(
Points( X( 1 ), X( 2 ), Y, Legend( 21 ) ),
Box Plot( X( 1 ), X( 2 ), Y, Legend( 22 ) )
)
);
It works great. However, if I put it all in a loop, hoping to generate a set of graphs (one for each of the column labels) each in their own window, it just updates the first graph instead:
for(i = 1, i <= N Items(analysisTests), i++,
gb = Data_Table << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Split ),
X( :Wafer, Position( 1 ) ),
Y( As Column( analysisTests[i] ) ),
Color( :Split )
),
Elements(
Points( X( 1 ), X( 2 ), Y, Legend( 21 ) ),
Box Plot( X( 1 ), X( 2 ), Y, Legend( 22 ) )
)
);
);How do I get it to show a set of graphs, each in it's own window? It seems like because its asking for a graph based on a data table I would need multiple data tables each with it's own graph, but it seems like there should be an easier way. I tried gb[i] hoping to get a separate graph for each loop, but that gives an error. -- Not subscriptable value in access or evaluation of 'Assign'
Not sure why that is - I would expect the default action to be that separate windows are created; as in this script:
dt = open("$SAMPLE_DATA/Big Class.jmp");
cols = dt << get column names;
for (i=1,i<=nitems(cols),i++,
dt << Graph Builder(
Size( 353, 317 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( eval(cols[i]) ) )
);
)
If I misunderstood what you meant by "window" - and that what you really want are lots of graphs in a single window then you need to put the graph in a container (that prevents it being rendered immediately) and then append it to a pre-existing display box (hlb in this example)
dt = open("$SAMPLE_DATA/Big Class.jmp");
cols = dt << get column names;
NewWindow("Demo",
hlb = HListBox()
);
for (i=1,i<=nitems(cols),i++,
content = VListBox(
dt << Graph Builder(
Size( 353, 317 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( eval(cols[i]) ) )
)
);
hlb << append(content)
);Thanks David,
This is actually exactly what I was doing, but it was only showing the last one. I ended up finding a bug in part of the "extra" script I didn't show and once that was fixed it started working correctly. So you're answer showed me that I was doing it right and pointed me in the right direction to finding the real problem. Thanks