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

- 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

May 16, 2019 4:42 AM
(3498 views)

Hi,

I build a bar chart in percent and need also to display zero percent (in the sniplet group2).

```
Names Default To Here( 1 );
dt = New Table("Test");
dt << new column ("C", numeric, Continuous);
dt << new column ("D", numeric, Continuous);
dt << new column ("E", numeric, Continuous);
:C << set values([1,2,3]);
:D << set values([1,2,3]);
:E << set values([1,0,0.5]);
dt << new column ("Percent", numeric, Continuous, Format( "Percent", 15, 3 ), Formula(:E/:D));
dt << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Variables( Y( :Percent ), Group X( :C ) ),
Elements( Bar( Y, Legend( 4 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
"Percent",
ScaleBox,
{Min( -0.113265306122449 ), Max( 1.08673469387755 ), Inc( 0.2 ),
Minor Ticks( 0 )}
)
)
);
```

Thanks for any help!

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

Hi @TWE,

I'm not aware of a way to force JMP to display the label for a truly 0 value. It's a bit of a workaround, but what I've done in the past is add a tiny amount to a value so that jmp will round to 0 and display that rounded value. For instance, using your example, by setting the value of :E[2] to 0.000000000000001 rather than 0, the 0% label displays on the graph:

```
Names Default To Here( 1 );
dt = New Table("Test");
dt << new column ("C", numeric, Continuous);
dt << new column ("D", numeric, Continuous);
dt << new column ("E", numeric, Continuous);
:C << set values([1,2,3]);
:D << set values([1,2,3]);
:E << set values([1,0.000000000000001,0.5]);
dt << new column ("Percent", numeric, Continuous, Format( "Percent", 15, 3 ), Formula(:E/:D));
dt << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Variables( Y( :Percent ), Group X( :C ) ),
Elements( Bar( Y, Legend( 4 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
"Percent",
ScaleBox,
{Min( -0.113265306122449 ), Max( 1.08673469387755 ), Inc( 0.2 ),
Minor Ticks( 0 )}
)
)
);
```

3 REPLIES 3

Highlighted

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

Hi @TWE,

I'm not aware of a way to force JMP to display the label for a truly 0 value. It's a bit of a workaround, but what I've done in the past is add a tiny amount to a value so that jmp will round to 0 and display that rounded value. For instance, using your example, by setting the value of :E[2] to 0.000000000000001 rather than 0, the 0% label displays on the graph:

```
Names Default To Here( 1 );
dt = New Table("Test");
dt << new column ("C", numeric, Continuous);
dt << new column ("D", numeric, Continuous);
dt << new column ("E", numeric, Continuous);
:C << set values([1,2,3]);
:D << set values([1,2,3]);
:E << set values([1,0.000000000000001,0.5]);
dt << new column ("Percent", numeric, Continuous, Format( "Percent", 15, 3 ), Formula(:E/:D));
dt << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Variables( Y( :Percent ), Group X( :C ) ),
Elements( Bar( Y, Legend( 4 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
"Percent",
ScaleBox,
{Min( -0.113265306122449 ), Max( 1.08673469387755 ), Inc( 0.2 ),
Minor Ticks( 0 )}
)
)
);
```

Highlighted
##

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

Re: Show zero percent in bar chart

Thanks this works well!

Highlighted
##

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

Re: Show zero percent in bar chart

Created:
May 16, 2019 6:26 AM
| Last Modified: May 16, 2019 6:45 AM
(3479 views)
| Posted in reply to message from TWE 05-16-2019

Another possible approach can be found in this link:

It should apply to percents, but I have not tried that.

Dan Obermiller

Article Labels

There are no labels assigned to this post.