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.
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.
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.
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" );
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
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" );
Thanks Jim and sorry for unclarity.
I ment labels of bars (Label by value), not axises.