Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Show/Hide Labels due to number of bars

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 12, 2020 6:25 AM
(670 views)

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

5 REPLIES 5

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Show/Hide Labels due to number of bars

Thank you Jim.

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" );
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Show/Hide Labels due to number of bars

Created:
Jul 13, 2020 8:41 AM
| Last Modified: Jul 13, 2020 9:04 AM
(595 views)
| Posted in reply to message from txnelson 07-13-2020

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

Learn it once, use it forever!