- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Need help with a script for broadcasting the Y axis lines on Graph Builder when using the "Page" layout function and keeping the Y axis Independant
Hey everyone,
While the new ability to stack the panels in Graph Builder is amazing a key to this amazingness is keeping the Y axis Independent of each other. However, when you have a lot of panels(levels) and want to add in Y axis grid lines you have to do them one by one, which is horrible. Any ideas on a script that would allow you to index through each panel and add grid lines independently?
Here you can see I used the old school way of (in the big class dataset) copying the axis settings and broadcasting a paste of them and while it does add in the gridlines it sets all the Y axis ranges to the same as the copied panel settings.
Thanks for any ideas!
Steve
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Need help with a script for broadcasting the Y axis lines on Graph Builder when using the "Page" layout function and keeping the Y axis Independant
Use XPath to get reference to the Axisboxes you are interested in (X, Y axis or both) and then do whatever you want with that list of axisboxes. This example enables Major Grid for Y-axis on all the frameboxes
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(893, 542),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Page(:age, Levels per Row(3)), Overlay(:sex)),
Elements(Points(X, Y, Legend(9)))
);
abs = Report(gb) << XPath("//AxisBox");
yaxis = abs[2::NItems(abs)::2];
yaxis << Show Major Grid(1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Need help with a script for broadcasting the Y axis lines on Graph Builder when using the "Page" layout function and keeping the Y axis Independant
Use XPath to get reference to the Axisboxes you are interested in (X, Y axis or both) and then do whatever you want with that list of axisboxes. This example enables Major Grid for Y-axis on all the frameboxes
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(893, 542),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Page(:age, Levels per Row(3)), Overlay(:sex)),
Elements(Points(X, Y, Legend(9)))
);
abs = Report(gb) << XPath("//AxisBox");
yaxis = abs[2::NItems(abs)::2];
yaxis << Show Major Grid(1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Need help with a script for broadcasting the Y axis lines on Graph Builder when using the "Page" layout function and keeping the Y axis Independant
That was fast, Jarmo! I like your solution better, but here's another way using Eval(Parse()).
Names Default To Here( 1 );
//Manually add your reference line to the top left panel of the graph builder.
//Then run this script with the graph builder report in focus.
axisList = Current Report() << XPath( "//AxisBox" );
//Grab axis specifications from vertical axis of first panel
//(vertical axes are even-numbered items; horizontal axes are odd)
axspecList = axisList[2] << Get Script();
//find the Reference Line among the other specifications
For( i = 1, i <= N Items( axspecList ), i++,
If( Left( Char( axspecList[i] ), 12 ) == "Add Ref Line",
rlindex = i;
Break();
)
);
//Reference Line specification as string
rlstr = Char( axspecList[rlindex] );
//Apply Reference Line specification to the remaining panels
For( j = 4, j <= N Items( axisList ), j = j + 2,
estr = "axisList[" || Char( j ) || "] <<" || rlstr;
Eval( Parse( estr ) );
);