cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
DMR
DMR
Level V

Hiding overlapping labels

How do I script in JSL the preference that I don't want to hide overlapping labels, please?  If possible I'd like the preference to relate only to a specific chart I've created within the Graph Builder, but I'll settle for a general preference if isn't possible.

I've found the reference to "Hide Overlapping Labels" within the Preferences section of the Scripting Index, but the example doesn't seem to work. I note that the example actually says:

Preferences[1] << Set( Hide Overlap Labels( 0 ) );

and I'm guessing this is probably a typo, but correcting it to

 

Preferences[1] << Set( Hide Overlapping Labels( 0 ) );
show preferences();

 doesn't seem to work either, although the preference does now appear in the list, and the relevant check box has changed its setting when "Preferences" is invoked from the File menu. Clicking on the "Apply" button of the Preferences window seems to force the required change to be acted upon, but I'm trying to do this from a script.

Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
DMR
DMR
Level V

Re: Hiding overlapping labels

Hi - I've realised what the problem was: either syntax works, but the chart needs to be redisplayed (e.g. "gb << reshow") after amending the preference for the change actually to take effect.  Having said that, it looks as though resetting Hide Overlapping Labels( 1 ) after forcing all of the labels to be displayed doesn't actually do anything unless the chart is resized (even if the size is exactly the same as originally) - but that can be easily accommodated by doing it via a little function like this:

 

	OverlappingLabels = function({myChart, YesNo}, {default local},
		// myChart is the chart I'm modifying; YesNo is either 0 or 1;
		preferences( Hide Overlapping Labels(YesNo));
		sizeList = (myChart << get size);
		myChart << Size( sizeList[1], sizeList[2] )
	);

 

Many thanks.

View solution in original post

4 REPLIES 4
gzmorgan0
Super User (Alumni)

Re: Hiding overlapping labels

I have always used this JSL syntax to change a preference.

 

preferences( Hide Overlapping Labels(0|1) );

DMR
DMR
Level V

Re: Hiding overlapping labels

Hi - I've realised what the problem was: either syntax works, but the chart needs to be redisplayed (e.g. "gb << reshow") after amending the preference for the change actually to take effect.  Having said that, it looks as though resetting Hide Overlapping Labels( 1 ) after forcing all of the labels to be displayed doesn't actually do anything unless the chart is resized (even if the size is exactly the same as originally) - but that can be easily accommodated by doing it via a little function like this:

 

	OverlappingLabels = function({myChart, YesNo}, {default local},
		// myChart is the chart I'm modifying; YesNo is either 0 or 1;
		preferences( Hide Overlapping Labels(YesNo));
		sizeList = (myChart << get size);
		myChart << Size( sizeList[1], sizeList[2] )
	);

 

Many thanks.

miguello
Level VI

Re: Hiding overlapping labels

Somehow it isn't working in JMP 15 even when you run it from Scripting Index:

Annotation 2020-09-23 103958.png

What am I doing wrong?

miguello
Level VI

Re: Hiding overlapping labels

Ok, it's Overlap vs. Overlapping.
And still I don't see any effect on my charts.