Dear all:
I want to create a parallel graphThe X-axis is part of the column in the tableHow to create using jsl
I also try add variable() but cannot work
thanks
<< Add Variable should work but some cases can be more complicated
Names Default To Here(1); dt = open("$SAMPLE_DATA/Big Class.jmp"); gb = dt << Graph Builder( Size(528, 448), Show Control Panel(0), Variables(X(:weight), X(:height, Position(1))), Elements(Parallel(X(1), X(2), Legend(9))) ); wait(1); // for demo purposes gb << Add Variable({:age, Role("X"), Position(1)});
If you build the parallel plot by hand and check the script
Graph Builder( Size(490, 448), Show Control Panel(0), Variables( X(:X__1), X(:X__2, Position(1)), X(:X__3, Position(1)), X(:X__4, Position(1)), X(:X__5, Position(1)) ), Elements(Parallel(X(1), X(2), X(3), X(4), X(5), Legend(18))) )
and then compare it to your script (build it and then get script from red triangle menu)
Graph Builder( Size(1854, 917), Show Control Panel(0), Variables( X(:X__1), X(:X__2, Position(1)), X(:X__3, Position(1)), X(:X__4, Position(1)), X(:X__5, Position(1)) ), Elements( Points(X(1), X(2), X(3), X(4), X(5), Legend(5)), Parallel(Legend(4), Combine Sets(1)) ) )
There are few big differences: you still have points left and you only haven't defined X() in your script.
If this is what you wish to do, I would suggest building the graph builder expression and not using << Add Variable and << Add Element as it can be easier
Names Default To Here(1); dt = Current Data Table(); colnames = dt << get column names("character"); Remove From(colnames, N Items(colnames)); Remove From(colnames, 1); variables_expr = Expr(Variables(X(:X__1))); parallel_expr = Expr(Parallel(X(1))); For Each({colname, idx}, colnames, xpart = EvalExpr(X(Expr(NameExpr(AsColumn(dt, colname))), Position(1))); Insert Into(variables_expr, Name Expr(xpart)); Eval(EvalExpr( Insert Into(parallel_expr, Name Expr(X(Expr(idx + 1)))); )); ); Insert Into(parallel_expr, Name Expr(Legend(18))); elements_expr = Expr(Elements()); InsertInto(elements_expr, NameExpr(parallel_expr)); gb = Eval(Substitute( Expr(dt << Graph Builder( Size(1854, 917), Show control Panel(0), _variables_, _elements_, Color(:color), Size(:Amt) )), Expr(_variables_), Name Expr(variables_expr), Expr(_elements_), Name Expr(elements_expr) ));
Thanks,
Have other question,
Now I can use Add Variable to add X variables to graph builder,
but cannot change to parallel graph for add X variable (auto) by use Add Element
Please refer to the attachment
Names Default To Here(1); dt=Current Data Table(); colnames=dt<< get column names( "character" ); remove from(colnames,nitems(colnames)); remove from(colnames,1); variables_expr = Expr(Variables(X(:X__1))); gb = dt << Graph Builder( Size( 1854, 917 ), Show control Panel(0), Variables(X(:X__1)), Color( :color ), Size( :Amt ) ); gb << inval; For Each({x_col, idx}, colnames, Eval(EvalExpr( gb << Add Variable({Expr(Name Expr(As Column(dt, x_col))), Role("X"),position(1)}) )); ); <FONT color="#0000FF">// question</FONT> <FONT color="#0000FF">gb << Add Element( 1, 1, {Type( "Parallel" ),Legend( 4 ),Combine Sets( 1 )} );</FONT> gb << Update window;