Subscribe Bookmark RSS Feed

graphics scripting dilemma in a report with multiple frameboxes

jeff3928

Community Trekker

Joined:

Jun 29, 2012

I'm trying to use JSL to draw horizontal lines in multiple frameboxes of an overlay plot report containing a "by" grouping. The desired y-intercept of the horizontal line varies from one framebox to the next. This seems easy to do with some loops and the "add graphics script" command however the horizontal lines always appear at the same location in every frame box. For example if the report has 5 frameboxes and the y-intercept list contains 5 different values, all 5 frameboxes will display the line at yintercept[5] because they all contain the exact same script: "HLine(yintercept);" and 5 was the last value of i. Any ideas on how to assign a unique script to each framebox?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I was able to solve this dilemma after doing some reading in the JMP 9 scripting guide. The key is to make use of the substitute function. My original code looked something like this:

for (i=1,i<=nBy,i++, //loop through each of the by groups in the report

     r[Frame Box(1)] << Add Graphics Script(2, HLine(HT));

);

After incorportating the substitute function it looks like this:

for (i=1,i<=nBy,i++, //loop through each of the by groups in the report

   eval(substitute(

    expr(r[Frame Box(1)] << Add Graphics Script(2, HLine(HT);

    )),expr(i),i);

   );

);

So now when I review the script associated with each framebox I see HLine(HT[1]), HLine(HT[2])... instead of HLine(HT)

1 REPLY
Solution

I was able to solve this dilemma after doing some reading in the JMP 9 scripting guide. The key is to make use of the substitute function. My original code looked something like this:

for (i=1,i<=nBy,i++, //loop through each of the by groups in the report

     r[Frame Box(1)] << Add Graphics Script(2, HLine(HT));

);

After incorportating the substitute function it looks like this:

for (i=1,i<=nBy,i++, //loop through each of the by groups in the report

   eval(substitute(

    expr(r[Frame Box(1)] << Add Graphics Script(2, HLine(HT);

    )),expr(i),i);

   );

);

So now when I review the script associated with each framebox I see HLine(HT[1]), HLine(HT[2])... instead of HLine(HT)