cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
hogi
Level XII

Revert Graph Builder title ?

When I change the title, in JSL a command 

Dispatch( {}, {"graph title"}, TextEditBox, {Set Text( "xx" )} )

is added.

 

Is there a JSL command to revert the title in Graph Builder to the default value?

2 ACCEPTED SOLUTIONS

Accepted Solutions
hogi
Level XII

Re: Revert Graph Builder title ?

my current workaround:

  • get the script of the report
  • close the report
  • remove the command for the Graph Title from the retrieved script
  • execute the changed code

View solution in original post

jthi
Super User

Re: Revert Graph Builder title ?

No idea if there is any way to revert that TextEditBox to default value but you could slightly modify your workaround. After executing the changed code (execute it inside V List Box or something so it won't create anything visible), pick the title from the "new" report, update your current one and then close the newly created one. 

 

View more...
Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 454),
	Show Control Panel(0),
	Variables(X(:height), Y(:weight)),
	Elements(Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2))),
	SendToReport(
		Dispatch({}, "graph title", TextEditBox, {Set Text("ABCD")})
	)
);

reset_gb_title = Function({gb}, {Default Local},
	s = gb << get script;
	titlechange = Extract Expr(s, Dispatch({}, "graph title", TextEditBox, Wild()));
	ngb = Substitute(Name Expr(s), Name Expr(titlechange), Expr(.));

	vlb = V List Box(ngb = ngb);
	default_title = Report(ngb)[TextEditBox(1)] << get text;

	Report(gb)[TextEditBox(1)] << Set Text(default_title);
	vlb << Delete Box();	
	
	Return(1);
);

wait(1); // demo purposes
reset_gb_title(gb);
Write();

 

 

-Jarmo

View solution in original post

3 REPLIES 3
hogi
Level XII

Re: Revert Graph Builder title ?

my current workaround:

  • get the script of the report
  • close the report
  • remove the command for the Graph Title from the retrieved script
  • execute the changed code
jthi
Super User

Re: Revert Graph Builder title ?

No idea if there is any way to revert that TextEditBox to default value but you could slightly modify your workaround. After executing the changed code (execute it inside V List Box or something so it won't create anything visible), pick the title from the "new" report, update your current one and then close the newly created one. 

 

View more...
Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Size(528, 454),
	Show Control Panel(0),
	Variables(X(:height), Y(:weight)),
	Elements(Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2))),
	SendToReport(
		Dispatch({}, "graph title", TextEditBox, {Set Text("ABCD")})
	)
);

reset_gb_title = Function({gb}, {Default Local},
	s = gb << get script;
	titlechange = Extract Expr(s, Dispatch({}, "graph title", TextEditBox, Wild()));
	ngb = Substitute(Name Expr(s), Name Expr(titlechange), Expr(.));

	vlb = V List Box(ngb = ngb);
	default_title = Report(ngb)[TextEditBox(1)] << get text;

	Report(gb)[TextEditBox(1)] << Set Text(default_title);
	vlb << Delete Box();	
	
	Return(1);
);

wait(1); // demo purposes
reset_gb_title(gb);
Write();

 

 

-Jarmo
hogi
Level XII

Re: Revert Graph Builder title ?

Nice, much better -  it doesn't create a new plot window.

Recommended Articles