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
tom_abramov
Level V

Show/Hide Labels due to number of bars

Hi,

What is the way in JSL to know how many bars a Graph Builder Bar chart has?

If there are many bars (>20), I would like to hide bar labels.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Show/Hide Labels due to number of bars

You can check to see what the Min, Max and Inc for the axis of interest is, determine the number of bars from that, an then set the labeling as desired.

Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Show/Hide Labels due to number of bars

You can check to see what the Min, Max and Inc for the axis of interest is, determine the number of bars from that, an then set the labeling as desired.

Jim
tom_abramov
Level V

Re: Show/Hide Labels due to number of bars

Thank you Jim.

@txnelson 

Another question: What is the syntax of adding labels after creating the chart.

The following doesn't work

gb = Graph Builder(
	Variables( X( :age ), Y( :height ), Group Y( :sex ) ),
	Elements( Bar( X, Y, Legend( 1 )  ) )
);

gb <<  Label( "Label by Value" );

 

txnelson
Super User

Re: Show/Hide Labels due to number of bars

The various labels are all accessible via the Tree Structure of the Output Report.  To learn about the them, read the sections in the Scripting Guide on Display Trees.  The Scripting Guide can be found in the JMP Documentation Library.

     Help==>JMP Documentation Library

treestr.PNG

Here is a little script that changes the various Labels on this style of graph

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

gb = Graph Builder(
	Variables( X( :age ), Y( :height ), Group Y( :sex ) ),
	Elements( Bar( X, Y, Legend( 1 ) ) )
);

gbr = gb << report;

gbr[Text Edit Box( 1 )] << set text( " This is the Header" );
gbr[Text Edit Box( 4 )] << set text( " This is the Y Axis Label" );
gbr[Text Edit Box( 3 )] << set text( " This is the X Axis Label" );
Jim
tom_abramov
Level V

Re: Show/Hide Labels due to number of bars

Thanks Jim and sorry for unclarity.

I ment labels of bars (Label by value), not axises.

@txnelson 

Re: Show/Hide Labels due to number of bars

The Bar element depends on the levels of the grouping variable. So you could also use the Summarize() function to determine the number of bars.