- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Graph Builder Script for more complicated reference lines
Is it possible to create a script for graph builder that can set Y-axis reference lines so that they start and end at specific X-axis points? I know how to create reference lines with ranges but I can't figure out how to adjust them so they cover specific areas on the other axis. I am attaching a Pdf that shows what I can do in JMP - the graph on the left - and what I would like to accomplish - the graph on the right. Help with this is greatly appreciated!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
Hi,
Here is one way to produce that type of graph: use JSL to draw a couple of rectangles where you want them. To do this, you will need to know the left and right axis limits, or simply draw the rectangles with limits so wide you know they'll always be offscreen.
Read about the rect( ) function for more details, but basically what you need to do for each rectangle is pick a fill color, pick a transparency level, then draw the rectangle using the rect() function, which takes 4 arguments: (left, top, right, bottom). This needs to be wrapped in an << add graphics script() message and sent to the graph's framebox. Using the format in the script below is one way to do that.
I've attached a table with this script so you can experiment.
Cheers,
Brady
Graph Builder(
Size( 523, 454 ),
Show Control Panel( 0 ),
Variables( X( :RandN1 ), Y( :RandN2 ) ),
Elements( Line( X, Y, Legend( 4 ) ) ),
//extra script begins here
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
1,
Description( "" ),
Fill Color( "blue" );
Transparency( .3 );
Rect( -2, 0, 0, -2, 1 );
Fill Color( "purple" );
Transparency( .3 );
Rect( 1, 2, 3, 0, 1 );
)}
)
)
//extra script ends here
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
When a Wrap column is specified, the Graph Builder produces a separate frame for each graph. The additional graphics has to be produced for each Frame Box(). This can be done in a looping operation, or as specified below by using an XPath() function which will apply the additional graphic on all Frame Box() objects.
Names Default To Here( 1 );
dt = open("$SAMPLE_DATA/semiconductor capability.jmp");
Graph Builder(
Size( 534, 492 ),
Show Control Panel( 0 ),
Variables( X( :NPN2 ), Y( :NPN1 ), Wrap( :lot_id ) ),
Elements( Line( X, Y, Legend( 8 ) ) )
);
(Current Report() << xpath( "//FrameBox" )) << Add Graphics Script(
Fill Color( "blue" );
Transparency( 0.3 );
Rect( 108, 112, 114, 100, 1 );
Fill Color( "purple" );
Transparency( 0.3 );
Rect( 118, 122, 122, 115, 1 );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
Hi,
Here is one way to produce that type of graph: use JSL to draw a couple of rectangles where you want them. To do this, you will need to know the left and right axis limits, or simply draw the rectangles with limits so wide you know they'll always be offscreen.
Read about the rect( ) function for more details, but basically what you need to do for each rectangle is pick a fill color, pick a transparency level, then draw the rectangle using the rect() function, which takes 4 arguments: (left, top, right, bottom). This needs to be wrapped in an << add graphics script() message and sent to the graph's framebox. Using the format in the script below is one way to do that.
I've attached a table with this script so you can experiment.
Cheers,
Brady
Graph Builder(
Size( 523, 454 ),
Show Control Panel( 0 ),
Variables( X( :RandN1 ), Y( :RandN2 ) ),
Elements( Line( X, Y, Legend( 4 ) ) ),
//extra script begins here
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
1,
Description( "" ),
Fill Color( "blue" );
Transparency( .3 );
Rect( -2, 0, 0, -2, 1 );
Fill Color( "purple" );
Transparency( .3 );
Rect( 1, 2, 3, 0, 1 );
)}
)
)
//extra script ends here
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
Thanks, Brady!
I will give that a shot!
Best,
Barbara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
Hi Brady,
I have gotten this to work in graphs that have no wraps but when I wrap, the rectangle (s) only shows up in the first panel. Is there a way to send the rectangle script to every level? I am attaching a simplified example to show what I mean.
Thank you!
Barbara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
When a Wrap column is specified, the Graph Builder produces a separate frame for each graph. The additional graphics has to be produced for each Frame Box(). This can be done in a looping operation, or as specified below by using an XPath() function which will apply the additional graphic on all Frame Box() objects.
Names Default To Here( 1 );
dt = open("$SAMPLE_DATA/semiconductor capability.jmp");
Graph Builder(
Size( 534, 492 ),
Show Control Panel( 0 ),
Variables( X( :NPN2 ), Y( :NPN1 ), Wrap( :lot_id ) ),
Elements( Line( X, Y, Legend( 8 ) ) )
);
(Current Report() << xpath( "//FrameBox" )) << Add Graphics Script(
Fill Color( "blue" );
Transparency( 0.3 );
Rect( 108, 112, 114, 100, 1 );
Fill Color( "purple" );
Transparency( 0.3 );
Rect( 118, 122, 122, 115, 1 );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Graph Builder Script for more complicated reference lines
Thanks, Jim! This works really well!
Barbara