cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
Georgios_Tsim
Level III

Conditionally colour text of a Data Table Box

I would like to colour the text of specific cells of a Data Table Box based on a condition. Take as example of what I am trying to do the following:
 
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where(:Age > 14);
:Age << Color Cells( "Red" );
 
the above gives the output:
Georgios_Tsim_0-1728651504719.png

but then the result in the window is:

 
win3 = New Window( "Combined Report",
Data Table Box(dt));
Georgios_Tsim_1-1728651585631.png

There is not any colour.

To sum up, what I am trying to do is similar to what happens with the p-values at the output windows of the models that they are  conditionally coloured as they approach the limit of 0.05.

 
3 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Conditionally colour text of a Data Table Box

If you use << get as report you can get the colors

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Where(:Age > 14);
:Age << Color Cells("Red");
dt << clear select;

nw = New Window("",
	dt << get as report
);

jthi_0-1728652600204.png

 

-Jarmo

View solution in original post

txnelson
Super User

Re: Conditionally colour text of a Data Table Box

A data table with cell colors can be moved into a journal

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt:name << color cells("red",{3,4,5,6,7});
dt:age << color cells("blue", {6, 8, 10});


nw = New Window("Output", <<journal);
dt << Journal;

txnelson_0-1728652930272.png

txnelson_2-1728652973234.png

Using an alternate methodology, the data table can be added to a non Journal window by passing it through a journal and then adding it to a standard display window

 

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt:name << color cells("red",{3,4,5,6,7});
dt:age << color cells("blue", {6, 8, 10});

nw = new window("Outline",ob=outlinebox("data table"));
ob<<append(dt << Journal);

current journal()<<close window;

txnelson_3-1728653771020.png

 

 

Jim

View solution in original post

jthi
Super User

Re: Conditionally colour text of a Data Table Box

You can modify the scrollable property of table box created

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Probe.jmp");
dt << Select Where(:Site > 2);
:Site << Color Cells("Red");
dt << clear select;

nw = New Window("",
	rep = dt << get as report
);

tb = rep << Child;
tb << Set Scrollable(0,0);
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Conditionally colour text of a Data Table Box

If you use << get as report you can get the colors

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Where(:Age > 14);
:Age << Color Cells("Red");
dt << clear select;

nw = New Window("",
	dt << get as report
);

jthi_0-1728652600204.png

 

-Jarmo
Georgios_Tsim
Level III

Re: Conditionally colour text of a Data Table Box

Nice! But in my case the table is wide and it has scrolling bars.

Georgios_Tsim_0-1728903255657.png

And this hides the las column that I do not want to. Is it possible to fit the width of the report table to the window?

jthi
Super User

Re: Conditionally colour text of a Data Table Box

You can modify the scrollable property of table box created

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Probe.jmp");
dt << Select Where(:Site > 2);
:Site << Color Cells("Red");
dt << clear select;

nw = New Window("",
	rep = dt << get as report
);

tb = rep << Child;
tb << Set Scrollable(0,0);
-Jarmo
txnelson
Super User

Re: Conditionally colour text of a Data Table Box

A data table with cell colors can be moved into a journal

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt:name << color cells("red",{3,4,5,6,7});
dt:age << color cells("blue", {6, 8, 10});


nw = New Window("Output", <<journal);
dt << Journal;

txnelson_0-1728652930272.png

txnelson_2-1728652973234.png

Using an alternate methodology, the data table can be added to a non Journal window by passing it through a journal and then adding it to a standard display window

 

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt:name << color cells("red",{3,4,5,6,7});
dt:age << color cells("blue", {6, 8, 10});

nw = new window("Outline",ob=outlinebox("data table"));
ob<<append(dt << Journal);

current journal()<<close window;

txnelson_3-1728653771020.png

 

 

Jim