BookmarkSubscribeRSS Feed
aandw

Community Trekker

Joined:

Mar 12, 2015

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
pmroz

Super User

Joined:

Jun 23, 2011

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

Community Trekker

Joined:

Mar 12, 2015

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

Joined:

Jun 23, 2011

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