Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level III

## graphics scripting dilemma in a report with multiple frameboxes

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
Highlighted
Level III

## Re: graphics scripting dilemma in a report with multiple frameboxes

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)

3 REPLIES 3
Highlighted
Level III

## Re: graphics scripting dilemma in a report with multiple frameboxes

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)

Highlighted
Level IV

## Re: graphics scripting dilemma in a report with multiple frameboxes

Hello again,

unfortunately i wasn´t able to solve the issue of adding different graphics scripts to multiple frameboxes with the above solution.

Here is my script:

``````for (i=1,i<=nBy,i++, //loop through each of the by groups in the report
minLine = Eval( Eval List(dPATMin[i]) );
maxLine = Eval( Eval List(dPATMax[i]) );
eval(
substitute(
expr(
rep[Frame Box(i)] << Add Graphics Script(
2,
H Line( minLine );
H Line( maxLine );
);
)
,
expr(i)
,
i
);
);
);``````

Does anyone has a solution for adding different "H Lines" to multiple FrameBoxes?

Thanks!

Highlighted
Level IV

## Re: graphics scripting dilemma in a report with multiple frameboxes

Maybe sometimes you have to talk about it...

Here is what made the trick for me:

``````for (i=1,i<=nBy,i++, //loop through each of the by groups in the report
minLine = Eval( Eval List(dPATMin[i]) );
maxLine = Eval( Eval List(dPATMax[i]) );
eval(
Eval Expr(
rep[Frame Box(i)] << Add Graphics Script(
2,
H Line( Expr(minLine) );
H Line( Expr(maxLine) );
);
)
);
);``````
Article Labels

There are no labels assigned to this post.