Is it possible to display more than one plot in the Hover Label?
I tried it by putting two plots into a H List Box, but noticed that
- the hover label just shows the first plot
- after clicking on the hover label, both plots show up, but the data filter is not applied to the second plot:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
Size( 401, 369 ),
Show Control Panel( 0 ),
Graph Spacing( 4 ),
Variables( X( :height ), Y( :weight ), color( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Set Graphlet(
Picture(
H List Box(
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :sex ), Y( :age ), color(:sex) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) )
),
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :sex ), Y( :height ), color(:sex) ),
Elements( Bar( X, Y, Legend( 6 ) ) )
)
)
)
)}
)
)
)Ouch, yes.
So, the _whereExpr wasn't the actual problem
--> actual issue fixed via Substitute
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
local_whereExpr = Expr(
:height == 61 & :weight == 128
); // for quick debugging
dt << Graph Builder(
Size( 401, 369 ),
Show Control Panel( 0 ),
Graph Spacing( 4 ),
Variables( X( :height ), Y( :weight ), color( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Set Graphlet(
Picture(
Show( Namespace( "local" ) << Get Contents() ); //contains :_whereExpr
// New Window("test", //for quick debugging
Eval(
Substitute(
Expr(
H List Box(
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) )
),
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) ),
Local DataFilter(
Close Outline( 1 ),
Add Filter( columns( :height, :weight ), Where( __myWhereExpr1__ ), Where( __myWhereExpr2__ ) )
)/*,
SendToReport( // Needen for Jmp 17
Dispatch({},"sex",ScaleBox,{Format( "Best", 9 ), Min( -0.5 ), Max( 1.5 ), Inc( 1 ), Minor Ticks( 0 )}),
Dispatch({},"age",ScaleBox,{Format( "Fixed Dec", 12, 0 ), Min( -0.5 ), Max( 5.5 ), Inc( 1 ), Minor Ticks( 0 )}
)
)*/
)
)
),
Expr( __myWhereExpr1__ ), Arg( Name Expr( local:_whereExpr ), 1 ),
Expr( __myWhereExpr2__ ), Arg( Name Expr( local:_whereExpr ), 2 ),
Expr( __myWhereExpr__ ),
Name Expr( local:_whereExpr )
)
);
)//
)}
)
)
);Might not be easily done (at least not with simple graphs, you can use pictures though). Hover labels do have quite good documentation in JMP Help site
A required script that adds a thumbnail of a graph or an image to the hover label.
Picture() is always executed in a Hover Label Execution Context derived from the current visual element. The first Picture Box (outside of a local data filter) found will be used to generate the displayed image.
More documentation Using JMP > JMP Reports > Customize Hover Labels in JMP Graphs
Hm, how to get access to the local:_whereExpr
I assume, a quite simple error, but I can't find it ...
Graph Builder(
Size( 401, 369 ),
Show Control Panel( 0 ),
Graph Spacing( 4 ),
Variables( X( :height ), Y( :weight ), color( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Set Graphlet(
Picture(
Show( Namespace( "local" ) << Get Contents() ); //contains :_whereExpr
Show(local:_whereExpr); // empty ?!?
Eval(Eval Expr(
Data Filter Context Box(
H List Box(
Current Data Table() << DataFilter( Local, Add Filter( columns( :height, :weight ), Where( Expr(Name Expr(local:_whereExpr)) )
) ),
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Graph Spacing( 4 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) )
),
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Graph Spacing( 4 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) )
);
)
)))
)
)}
)
)
);
Most likely your _whereExpr is getting evaluated and returning missing value.
Ouch, yes.
So, the _whereExpr wasn't the actual problem
--> actual issue fixed via Substitute
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
local_whereExpr = Expr(
:height == 61 & :weight == 128
); // for quick debugging
dt << Graph Builder(
Size( 401, 369 ),
Show Control Panel( 0 ),
Graph Spacing( 4 ),
Variables( X( :height ), Y( :weight ), color( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Set Graphlet(
Picture(
Show( Namespace( "local" ) << Get Contents() ); //contains :_whereExpr
// New Window("test", //for quick debugging
Eval(
Substitute(
Expr(
H List Box(
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) )
),
Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :sex ), Y( :age ), Color( :sex ) ),
Elements( Heatmap( X, Y, Legend( 5 ) ) ),
Local DataFilter(
Close Outline( 1 ),
Add Filter( columns( :height, :weight ), Where( __myWhereExpr1__ ), Where( __myWhereExpr2__ ) )
)/*,
SendToReport( // Needen for Jmp 17
Dispatch({},"sex",ScaleBox,{Format( "Best", 9 ), Min( -0.5 ), Max( 1.5 ), Inc( 1 ), Minor Ticks( 0 )}),
Dispatch({},"age",ScaleBox,{Format( "Fixed Dec", 12, 0 ), Min( -0.5 ), Max( 5.5 ), Inc( 1 ), Minor Ticks( 0 )}
)
)*/
)
)
),
Expr( __myWhereExpr1__ ), Arg( Name Expr( local:_whereExpr ), 1 ),
Expr( __myWhereExpr2__ ), Arg( Name Expr( local:_whereExpr ), 2 ),
Expr( __myWhereExpr__ ),
Name Expr( local:_whereExpr )
)
);
)//
)}
)
)
);By the way:
I generated the second subplot directly including the data filter from the beginning.
The first subplot gets the DataFilter via the Hover Label Framework - after being initialized without Data filter.
This reminds me of another topic:
https://community.jmp.com/t5/Discussions/speeding-up-heatmap-graphs/m-p/571277/highlight/true#M78103
And indeed, Jmp 16 and Jmp17 behave different here:
On Jmp16, the data filter is always added after the initialization of the graph - even if the data filter is part of the Graph Builder code.
Therefore, for both plots, the range is locked via Lock Scales( 1 ) to the full range -> both plots look the same.
On Jmp17, if the data filter is part of the GraphBuilder code (second graph), the data filter is added immediately.
Therefore the axis ranges of the second plot are restricted to the filtered data.
-> new: If needed, one has to specify the axis ranges manually.
Jmp 17:
Jmp 16
maybe, sometimes this is exactly what the user wants:
- show just one graph with the "hover" filter applied
- and when you click on it:
- open the same graph
- plus a second "static" graph - without a "hover" filter applied
If so, one could call this bug a feature.
In Graph-Builder-30-Second-Challenge @martindemel shows that one doesn't even need a surrounding H/V List Box.