- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
issue with get legend items
In JMP18 (18.1.1) this example from scripting index doesn't work:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :height ), Y( :weight ), Overlay( :sex ), Color( :age ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
server = gb << Get Legend Server;
items = server << Get Legend Items;
For Each( {item, index}, items[1],
item << Set Label( "Item " || Char( index ) )
);
It produces the error message:
so, Legend Server << get legend items()
doesn't return scriptable objects?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get legend items: no scriptable objects
workaround:
use get legend item
Don't forget to pre-evaluate i for get legend item
- for set label no pre-evaluation is needed.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :height ), Y( :weight ), Overlay( :sex ), Color( :age ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
server = gb << Get Legend Server;
Nitems = Nitems(( server << Get Legend Items)[1]);
for(i=1, i<= Nitems, i++,
Eval(Eval Expr(item = server << Get Legend Item(1, Expr(i))));
item << Set Label( "Item " || Char( i ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get legend items: no scriptable objects
Next trap: doesn' work for Bar Graphs ?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb =Graph Builder(
Variables( X( :age ), Y( :weight ), Overlay( :sex ) ),
Elements( Bar( X, Y ) )
);
server = gb << Get Legend Server;
items = server << Get Legend Items;
show(items);
server << get legend item(1,1) // error message
edit: I could not reproduce the issue on another computer / after a restart of JMP (?).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get legend items: no scriptable objects
It actually does return scriptable objects. Looks like this is a bug with For Each(). If you change the code to something that should be equivalent, it works.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :height ), Y( :weight ), Overlay( :sex ), Color( :age ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
server = gb << Get Legend Server;
items = server << Get Legend Items;
For Each( {item, index}, items[1],
items[1][index] /*isn't this exactly what item is?*/ << Set Label( "Item " || Char( index ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get legend items: no scriptable objects
Ah, sorry, you are right, the individual items are indeed scriptable.
Interesting: a batch message like items << get label
produces the same issue.
maybe batch messages use for each in the background ?
Digging deeper, I found an old ticket: TS-00128192
Fortunately, in the mean time the issue got enough prio -- in JMP19 (EA5) it's fixed:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :height ), Y( :weight ), Overlay( :sex ), Color( :age ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
server = gb << Get Legend Server;
items = server << Get Legend Items;items << get label // same issue as with for each
show(items[1][1])
items[1][1] << get label(); // OK, on the lowest level, there is a scriptable object
Show(tmp = items[1][1::2]); // then this is a list of ...
tmp[1] << get Label(); // ...no
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: get legend items: no scriptable objects
@mmarchandFSLR wrote:It actually does return scriptable objects.
on the other hand ... a bit surprising:
JMP19: