cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Graphics script reported errors in log

Hi,

 

I wrote a script to draw control charts. When I run the script all is good. However, when I open the project with the control charts there is an error on the plots "Graphics script reported errors in log".

PersuasionCamel_0-1673872615464.png

How can I fix the issue or hide the issue message ?

 

Thank you very much for your answer and have a nice day,

 

Jean

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Graphics script reported errors in log

Sorry, I missed the question earlier. You'll need to put the outer part, eval( evalexpr( ... ) ) around a bigger chunk of code than you showed. Something like this:

 

split = something;
row_text = ... ;
column_text = ... ;
...
eval(evalexpr(
   ccb = dt<<controlchart(...expr(split)...expr(column_text)...expr(split)...)
))

the variables, split, etc, must be set first. evalexpr will search for the expr and replace them with their values, then eval will run the finished expression.

Craige

View solution in original post

5 REPLIES 5
Phil_Kay
Staff

Re: Graphics script reported errors in log

Hi @PersuasionCamel (intriguing name!),

I am sure that someone in the community will be able to help, but I think they might need a bit more information about what you were doing. I am not sure what you mean by "the project with the control charts."

Thanks,

Phil

Craige_Hales
Super User

Re: Graphics script reported errors in log

Sometimes JMP graphs include some JSL scripting to draw parts of the graph. If the script has an error it prevents the rest of the graph from drawing. The error message is in the Log window, and we'd need to see it to know more, but I'd guess the script depends on a variable's value that is not available later.

The message in the graph is so you don't get a completely empty graph with no hint where to look for an answer.

 

The usual solution to the variable-not-available problem is to use substitute() or evalexpr() to replace the variable in the script with the variable's value. Something like (untested...)

x = 20; y=10;
eval( evalexpr( g<<addgraphicscript( text({expr(x),expr(y)}, "hello") ) ) )

which results in a graphic script with hard coded 20,10 location for the hello text and no dependency on x and y later.

Craige

Re: Graphics script reported errors in log

Hi,

 

Ah yes, you are right: my problem is that in my code, I defined some values for my variables that are used to write a text and draw a line in my plots.

Here is a part of my code that is used to define the vertical line at "Split - 0.5" and a text at the variables "row_text" and "column_text" (written in bold and underlined). The issue is that when I open my JMP project after saving and closing it, the vertical line and the text doesn't appear.

 

				Dispatch(
					{},
					"Control Chart Builder",
					FrameBox,
					{Marker Size( 4 ), Add Graphics Script( 2, Description( "" ), Text( {20, 100}, "" ) ),
					Add Graphics Script(
						3,
						Description( "" ),
						Pen Color( "black" );
						V Line( Split - 0.5 );
					), Grid Line Order( 1 ), Reference Line Order( 4 ), DispatchSeg(
						TopSeg( 1 ),
						{Set Script(
							Text( Row_text, Column_text, "Previous Period" );

						)}
					), DispatchSeg(
						TopSeg( 2 ),
						{Set Script(
							Pen Color( "black" );
							V Line( Split - 0.5 );
						)}
					)}
				)

How can I change the code with the "evalexpr" function to avoid the issue?

 

Thank you very much and have a nice day,

 

Jean

Craige_Hales
Super User

Re: Graphics script reported errors in log

Sorry, I missed the question earlier. You'll need to put the outer part, eval( evalexpr( ... ) ) around a bigger chunk of code than you showed. Something like this:

 

split = something;
row_text = ... ;
column_text = ... ;
...
eval(evalexpr(
   ccb = dt<<controlchart(...expr(split)...expr(column_text)...expr(split)...)
))

the variables, split, etc, must be set first. evalexpr will search for the expr and replace them with their values, then eval will run the finished expression.

Craige

Re: Graphics script reported errors in log

It finally works! 

 

Thank you very much!