Subscribe Bookmark RSS Feed

Table in a sheet panel?

peder

Community Trekker

Joined:

Jul 27, 2013

I am trying to script a way to fit a graph and a table on to 1 PDF page. Landscape A4.

The problem is that the table is wide, and must be resized.

It seems like sheet panels could be used, since they fit the contents to a grid. In this case a 1 x 2 grid. I want the table to go in the bottom, but I've had no luck in finding a way to put it there.

4580_table-in-sheet.png

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Here's an example showing two ways to put a table in a sheet box:

1. Use a Data Grid Box which only shows a data table (JMP 11 only)

2. Use a Table Box inside a Scroll Box, which shows any content you put in it.

Both use scrolling for wide tables. You can use a Scroll Box without Sheet Boxes, if you only want to limit the size,

Names Default To Here( 1 );

Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "Example",

  V Sheet Box(

  Sheet Part( "weight by height",

  Graph Builder( Show Control Panel( 0 ),

  Variables( X( :height ), Y( :weight ), Group X( :sex ) ),

  Elements( Points( X, Y ), Smoother( X, Y ) )

  )),

  Sheet Part( "grid box",

  dgb = Data Grid Box( ); dgb << Set Data Table( current data table()); dgb

  ),

  Sheet Part( "table box inside scrollbox",

  scroll Box(Data Table Box( current data table()));

  )

  )

);

5 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

You can use a Tablebox, which can contain Stringcolbox and Numbercolbox objects.  Try running the following code.  After it displays click on File > Save As and choose PDF as the filetype. 

// Tablebox example

dt = open("$sample_data\Blood Pressure.jmp");

subj_list  = column(dt, "Subject") << get values;

dose_list  = column(dt, "Dose")    << get values;

bp8m_list  = column(dt, "BP 8M")   << get values;

bp12m_list = column(dt, "BP 12M")  << get values;

bp6m_list  = column(dt, "BP 6M")   << get values;

bp8w_list  = column(dt, "BP 8W")   << get values;

bp12w_list = column(dt, "BP 12W")  << get values;

bp6w_list  = column(dt, "BP 6W")   << get values;

bp8f_list  = column(dt, "BP 8F")   << get values;

bp12f_list = column(dt, "BP 12F")  << get values;

bp6f_list  = column(dt, "BP 6F")   << get values;

bp_win = new window("Blood Pressure Data",

    vlistbox(

        gb = Graph Builder( Size( 570, 303 ), Show Control Panel( 0 ),

            Variables( X( :Dose ), Y( :BP 8M ), Y( :BP 12M, Position( 1 ) ),

                Y( :BP 6M, Position( 1 ) ), Y( :BP 8W, Position( 1 ) ),

                Y( :BP 12W, Position( 1 ) ), Y( :BP 6W, Position( 1 ) ),

                Y( :BP 8F, Position( 1 ) ), Y( :BP 12F, Position( 1 ) ),

                Y( :BP 6F, Position( 1 ) )

            ),

            Elements( Box Plot( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Y( 5 ), Y( 6 ), Y( 7 ),

                    Y( 8 ), Y( 9 ), Legend( 4 ), Jitter( 1 ), Outliers( 1 ),

                    Box Style( "Outlier" )

                )

            )

        ),

        tb = tablebox(

            number col box("Subject", subj_list),

            string col box("Dose", dose_list),

            number col box("BP 8M", bp8m_list),

            number col box("BP 12M", bp12m_list),

            number col box("BP 6M", bp6m_list),

            number col box("BP 8W", bp8w_list),

            number col box("BP 12W", bp12w_list),

            number col box("BP 6W", bp6w_list),

            number col box("BP 8F", bp8f_list),

            number col box("BP 12F", bp12f_list),

            number col box("BP 6F", bp6f_list),

        )

    ),

    tb << table style(Bordered)

);


4587_BP ChartTable.png

peder

Community Trekker

Joined:

Jul 27, 2013

That's a really nice solution PMroz. It's not in a sheet-panel, and it seems to me that Data Table  Box() will do the same, but easier because I don't have to specify all the columns. But thanks.

pmroz

Super User

Joined:

Jun 23, 2011

I wasn't aware of the Data Table Box method - learn something new every day!  Thanks Xan!

Solution

Here's an example showing two ways to put a table in a sheet box:

1. Use a Data Grid Box which only shows a data table (JMP 11 only)

2. Use a Table Box inside a Scroll Box, which shows any content you put in it.

Both use scrolling for wide tables. You can use a Scroll Box without Sheet Boxes, if you only want to limit the size,

Names Default To Here( 1 );

Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "Example",

  V Sheet Box(

  Sheet Part( "weight by height",

  Graph Builder( Show Control Panel( 0 ),

  Variables( X( :height ), Y( :weight ), Group X( :sex ) ),

  Elements( Points( X, Y ), Smoother( X, Y ) )

  )),

  Sheet Part( "grid box",

  dgb = Data Grid Box( ); dgb << Set Data Table( current data table()); dgb

  ),

  Sheet Part( "table box inside scrollbox",

  scroll Box(Data Table Box( current data table()));

  )

  )

);

peder

Community Trekker

Joined:

Jul 27, 2013

Xan@jmp: That's spot on! Just what I needed. Thanks! You're right - the editable data table itself doesn't work in JMP 10, but that wasn't what I needed right now.

- and so simple, too...