cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
JesperJohansen
Level IV

Changing the scales of a graph box

Hi

 

I am wirking on a custom graph. I want to draw the graph similar to this:

nw = New Window("Test",
Outline Box( "Outline",
gb = Graph Box(
FrameSize( 600, 300),
XName("X axis"),
YName("Y axis"),
X Scale( 0, 5*Pi() ),
Y Scale( -1, 1 )
)
)
);

gb << Set Graphics Script(Y Function(Sin(x), x));

 

Now I want to change the scales of the graph. I can drag to change the size and scale of the graph, but how do I change properties like "FrameSize" or "XName" by script, after I made the graph?

 

BR

Jesper

BR
Jesper
1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Changing the scales of a graph box

I'm not sure why the gb<<framesize and gb<<xscale and gb<<Xname messages won't work (added to my list, thanks!), but these messages do:

gb<<setWidth(500); // or Height
gb<<getXaxis; // try this to see the syntax
gb<<setXaxis(min(1),max(3)); // uses same syntax
gb[textbox(1)]<<settext("Ralph"); // text box 1 is Y, 2 is X

The setXaxis message controls all of the axis parameters; here's what getXaxis returned:

{Scale( "Linear" ), Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 15.707963267949 ),
Interval( "Numeric" ), Inc( 5 ), Minor Ticks( 1 ), Label Row Nesting( 1 ),
Label Row(
    {Automatic Font Size( 0 ), Automatic Tick Marks( 0 ), Inside Ticks( 0 ),
    Label Orientation( "Horizontal" ), Major Grid Line Color( -14145495 ),
    Minor Grid Line Color( -15790320 ), Show Major Grid( 0 ), Show Major Labels( 1 ),
    Show Major Ticks( 1 ), Show Minor Grid( 0 ), Show Minor Labels( 0 ),
    Show Minor Ticks( 1 ), Tick Offset( 0 )}
)}

(Using JMP 13, might be fewer options in earlier versions.)

 

Craige

View solution in original post

5 REPLIES 5
Craige_Hales
Super User

Re: Changing the scales of a graph box

I'm not sure why the gb<<framesize and gb<<xscale and gb<<Xname messages won't work (added to my list, thanks!), but these messages do:

gb<<setWidth(500); // or Height
gb<<getXaxis; // try this to see the syntax
gb<<setXaxis(min(1),max(3)); // uses same syntax
gb[textbox(1)]<<settext("Ralph"); // text box 1 is Y, 2 is X

The setXaxis message controls all of the axis parameters; here's what getXaxis returned:

{Scale( "Linear" ), Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 15.707963267949 ),
Interval( "Numeric" ), Inc( 5 ), Minor Ticks( 1 ), Label Row Nesting( 1 ),
Label Row(
    {Automatic Font Size( 0 ), Automatic Tick Marks( 0 ), Inside Ticks( 0 ),
    Label Orientation( "Horizontal" ), Major Grid Line Color( -14145495 ),
    Minor Grid Line Color( -15790320 ), Show Major Grid( 0 ), Show Major Labels( 1 ),
    Show Major Ticks( 1 ), Show Minor Grid( 0 ), Show Minor Labels( 0 ),
    Show Minor Ticks( 1 ), Tick Offset( 0 )}
)}

(Using JMP 13, might be fewer options in earlier versions.)

 

Craige
JesperJohansen
Level IV

Re: Changing the scales of a graph box

Thank you. Just what I was looking for :)
BR
Jesper
hogi
Level XII

Re: Changing the scales of a graph box

an alternative approach: Send a message to the AxisBox 

gb[Axisbox( 1 )] << {Min( 1 ), Max( 3 )};

... which, unfortunately, is not available if the axis is not available due to SuppressAxes.
And I didn't want to show, change and hide again the axis. 

So, thanks a lot for this EasterEgg

 

btw.
seems that curly brackets are necessary to get the second argument executed as well:

 

gb<<setXaxis({min(1),max(3)});
hogi
Level XII

Re: Changing the scales of a graph box

Ouch!


So even 

gb<<setXaxis({min(1),max(3)});

talks to the AxisBox.
After re-enabling the SuppressAxes, the rescale command didn't wok anymore
--> no AxisBox, no rescale possible.

hogi
Level XII

Re: Changing the scales of a graph box


@hogi wrote:

And I didn't want to showchange and hide again the axis.


Now, with the feeling that I do not have another choice  ...
is there even a possibility to do so?

 

Like FrameSize, SuppressAxes doesn't seem to work if sent to a Graph Box - although it seems to be a valid message to be sent to a Graph Box:

hogi_1-1675001398829.png                     hogi_0-1675001342958.png