Dear Community,
I'm struggling a bit with drawing reference lines on an ordinal axis. There are great examples on how to draw reference lines on continuous axes, but it seems to be different for ordinal axes. So in the example below I cannot tell JMP to draw a reference line at age of 13, instead I need to find the position at the axis in the GraphBuilder (that is two: 13 is the second age value when ordering from low to high) and set the reference line for that position. So far ok.
But I want to draw reference lines on many Graph Builder objects, that itself have local data filters, and thus have the same year e.g. 13 at different positions. You can try, if you exclude age=12 by local data filter, the the reference line is at the wrong position.
So a better strategy would be for me to be able to get the values from the x-axis of the Graph Builder object, so I could correctly add a reference line at age=13 for each Graph Builder.
In my real world example I have to set the reference line for each GraphBuilder in a dashboard with different filters at current calender week, that is given in a format of "YYYYWW".
JMP16 / Pro on Win10.
Any ideas? Thanks in advance
Names Default To Here( 1 );
// test reference lines for ordinal/nominal axis
// Open table and make graph
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
gb_obj = dt << graph builder( Show Control Panel( 0 ), variables( x( :age ), y( :weight ) ), Elements( bar( X, Y ) ) );
// get location of certain ordinal or nominal value from data table
refpos="13";
Summarize( dt, age_lst = by( :age ) );
label = Loc( age_lst, refpos );
// apply reference lines at different positions
Report( gb_obj )[AxisBox( 1 )] << add ref line( Eval( label - 1 ), "Dotted", "Red", refpos, 3 );
Georg