- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Show zero percent in bar chart
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!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Show zero percent in bar chart
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 )}
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Show zero percent in bar chart
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 )}
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Show zero percent in bar chart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Show zero percent in bar chart
Another possible approach can be found in this link:
It should apply to percents, but I have not tried that.