cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar

Automatically resizing graph boxes

Hi,

I have several Graph Boxes in an assortment of different tabs within the same overall window. Any of them can be resized manually by the user dragging the borders and/or the corners in the usual way. However, I want all of them to be automatically and immediately resized to the same new size if the user changes the size of any one of them. Can anyone tell me how this could be scripted, please?

Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Automatically resizing graph boxes

One option would be to make the graphs auto-stretching.  In this type of window you will want to resize the window rather than resizing an individual graph.

New Window( "stretch",

      Tab Box(

            "Tab 1",

            Graph Box(

                  Y Scale( -10, 90 ),

                  X Scale( -10, 90 ),

                  Fill Color( "red" ),

                  Oval(

                        X Origin() + 10,

                        (Y Origin() + Y Range()) - 10,

                        (X Origin() + X Range()) - 10,

                        Y Origin() + 10,

                        1

                  ),

                  Title( "Oval 1" ),

                  <<Set Auto Stretching( 1, 1 )

            ),

            "Tab 2",

            Graph Box(

                  Y Scale( -10, 90 ),

                  X Scale( -10, 90 ),

                  Fill Color( "green" ),

                  Oval(

                        X Origin() + 10,

                        (Y Origin() + Y Range()) - 10,

                        (X Origin() + X Range()) - 10,

                        Y Origin() + 10,

                        1

                  ),

                  Title( "Oval 2" ),

                  <<Set Auto Stretching( 1, 1 )

            )

      )

)

View solution in original post

3 REPLIES 3

Re: Automatically resizing graph boxes

One option would be to make the graphs auto-stretching.  In this type of window you will want to resize the window rather than resizing an individual graph.

New Window( "stretch",

      Tab Box(

            "Tab 1",

            Graph Box(

                  Y Scale( -10, 90 ),

                  X Scale( -10, 90 ),

                  Fill Color( "red" ),

                  Oval(

                        X Origin() + 10,

                        (Y Origin() + Y Range()) - 10,

                        (X Origin() + X Range()) - 10,

                        Y Origin() + 10,

                        1

                  ),

                  Title( "Oval 1" ),

                  <<Set Auto Stretching( 1, 1 )

            ),

            "Tab 2",

            Graph Box(

                  Y Scale( -10, 90 ),

                  X Scale( -10, 90 ),

                  Fill Color( "green" ),

                  Oval(

                        X Origin() + 10,

                        (Y Origin() + Y Range()) - 10,

                        (X Origin() + X Range()) - 10,

                        Y Origin() + 10,

                        1

                  ),

                  Title( "Oval 2" ),

                  <<Set Auto Stretching( 1, 1 )

            )

      )

)

Re: Automatically resizing graph boxes

You might need to use a script, such as the one supplied by Dan.

Did you try resizing one of the plots by dragging WHILE holding the CTRL key in Windows or the Apple key in Mac? This modifier key generally 'broadcasts' any interaction (such as resizing with a drag) with other objects that can respond to the same action.

clausa
Level III

Re: Automatically resizing graph boxes

A bit convoluted, but if you want the user to control the window size I think that this would work: you could add a button the graph window that says change size and create a prompt from there for them to input the size in pixels. This could then be sent to each graph to alter its size.