cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
aandw
Level II

Control Graph Label Value Decimal Output in JSL Script

/*

I would like to control the decimal output for graph labels within JSL script.

I need to set the number of decimal places displayed explicitly, as opposed to graph builder default.

For Example:  Increase decimal from 3 to 5.

I have been unable to locate this control within Garph Builder Axis Settings or JMP Preferences.

I assume the control command occurs within or just after the  Label( "Value" ) command.

Using DiamondData sample dataset. 

*/

// Sample dataset DiamondsData

// Review Directory

dt = Open("C:\Desktop\DiamondsData.jmp");

// Create Average of Carat by Cut

new column("cut_carat_agv",

  numeric,

  continuous,

  formula( Col Mean( :Carat Size, :Cut))

);

//Graph hBar of Average Carat Size by Cut with Bar Label "Value"

Graph Builder(

  Show Control Panel( 0 ),

  Variables( X( :cut_carat_agv ), Y( :Cut ) ),

  Elements(

  Bar(

  X,

  Y,

  Legend( 2 ),

  Bar Style( "Side by side" ),

  Summary Statistic( "Mean" ),

  // Assume Decimal control for Label occurs here

  Label( "Value" )

  )

  ),

  SendToReport(

  Dispatch(

  {},

  "graph title",

  TextEditBox,

  {Set Text( "Average Carat Size by Cut" )}

  ),

  Dispatch( {}, "X title", TextEditBox, {Set Text( "Average Carat Size" )} )

  )

);

3 REPLIES 3
pmroz
Super User

Re: Control Graph Label Value Decimal Output in JSL Script

If you double-click on the X axis, the format is shown at the top.  In this example I changed Dec from 1 to 3.  When you click on the graph builder little red triangle and copy the script this is what you get:

Graph Builder(

     Show Control Panel( 0 ),

     Variables( X( :cut_carat_agv ), Y( :Cut ) ),

     Elements(

           Bar(

                X,

                Y,

                Legend( 2 ),

                Bar Style( "Side by side" ),

                Summary Statistic( "Mean" ),

                Label( "Value" )

           )

     ),

     SendToReport(

           Dispatch( {}, "cut_carat_agv", ScaleBox, {Format( "Fixed Dec", 10, 3 )} ),   // Here's the format

           Dispatch(

                {},

                "graph title",

                TextEditBox,

                {Set Text( "Average Carat Size by Cut" )}

           ),

           Dispatch( {}, "X title", TextEditBox, {Set Text( "Average Carat Size" )} )

     )

);

aandw
Level II

Re: Control Graph Label Value Decimal Output in JSL Script

// The command appears to control the x-axis label.

// I am attempting to control the value label applied to the graph bar

// Apologies if I have misinterpreted.

//Graph hBar of Average Carat Size by Cut with Bar Label "Value"

Graph Builder(

  Show Control Panel( 0 ),

  Variables( X( :cut_carat_agv ), Y( :Cut ) ),

  Elements(

  Bar(

  X,

  Y,

  Legend( 2 ),

  Bar Style( "Side by side" ),

  Summary Statistic( "Mean" ),

  // Assume Decimal control for Graph Bar Label occurs here

  // within Lable command

  Label( "Value" )

// or subsequent

  )

  ),

  SendToReport(

  // this Dispatch command appears to control x-axis label decimal

  //Dispatch( {}, "cut_carat_agv", ScaleBox, {Format( "Fixed Dec", 10, 3 )} ),

  Dispatch(

  {},

  "graph title",

  TextEditBox,

  {Set Text( "Average Carat Size by Cut" )}

  ),

  Dispatch( {}, "X title", TextEditBox, {Set Text( "Average Carat Size" )} )

  )

);

pmroz
Super User

Re: Control Graph Label Value Decimal Output in JSL Script

Hmmmm not sure how to set the format of bar labels.  Looked at the graph builder tree structure but there didn't seem to be a place to control that.

gb = graph builder(.....)

gb << show tree structure;

8670_GB Tree Structure.png