Choose Language Hide Translation Bar
Highlighted
blue1994
Level III

How to append charts into a report with tabs

Hi, everyone

I have face one problem here, how can i divide the the chart into different tab?
Now i have 5 tabs with different product names,and each of the product has its own chart.

VC << Variability chart(
    Y(:Name( "I_P3G_G_PSVT_0.6/0.06" ) ,:Name( "I_P3HG_G_PHVT_0.6/0.06" ),:Name("NEW_I_P3G_G_PSVT_0.6/0.06") , :Name("NEW_I_P3HG_G_PHVT_0.6/0.06"), :Name("Gross Yield") ),
	X( :Name( "Lot" ), :Name( "F_V_L " ) ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	
);

On the above code, it will generate out 3 types of products(meant here 3 different product name) with 5 variability charts(all the charts are different from each other-data extract from dataset), so how can i append these 3 different types of product into 3 different tabs?How to divide each of the chart and then append into tabs?

 

This is the tabs that are already created:

VariabilityWindow = New Window("Variability Chart",tb = Tab Box() );

For(i = 1, i <=Nrows(dt2), i++,
	tb << insert(
		dt2: F D[i] || Char(i),
		V list Box(
			Button Box("Variability Chart #" || Char(i) ),
)
)
);

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: How to append the chart into tabs

Now I see why I hadn't used the "invisible" trick. It really does make a window, and the report attaches to the window. Try this instead:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

xList = {:height, :weight};
yList = {:height, :weight};

// Create a display window
nw = New Window( "test", tb = Tab Box() );

// Loop over the lists
For( x = 1, x <= N Items( xList ), x++,
	For( y = 1, y <= N Items( yList ), y++, 
		// Make a tab box in the window
		tb << Append(
			"Tab " || Char( x ) || Char( y ),
			V List Box( bivariate( x( xList[x] ), y( yList[y] ) ) )
		)
	)
);

When a report is created, it "looks around" to see what it should attach itself to. Usually it doesn't find anything and it makes a new report window and attaches itself to that. "invisible" only makes the window be hidden...it is still being created to anchor the report. Later, the append command looks at the display box (that is anchored in a hidden window) and makes a clone of it, since the same box can't be in two places. Clones are disconnected from the table (and that's how journals are made so they don't depend on a data table). But in this example, the bivariate report looks around and sees it is being created inside a VListBox and doesn't need to make a window. Append then looks at the VListBox and sees it is not attached to anything else and uses it without making a clone. So you wind up with 4 tabs of live reports.

Selection works on live reportSelection works on live report

Craige

View solution in original post

8 REPLIES 8
Highlighted
txnelson
Super User

Re: How to append the chart into tabs

JMP allows one to append, prepend, sibappend, etc. to any other object.  All that has to be done, is to identify the object to be moved, and the object to be moved to, and then determine what placement (append, prepend, etc.) that provides the desired placement.  Here is an example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

// Create a display window
nw = New Window( "test", tb = Tab Box( "tab 1", vlb1 = V List Box() ) );

// create a display
biv1 = bivariate( x( :height ), y( :weight ), invisible );

// Move the chart to the tab box
vlb1 << append( Report( biv1 ) );
Jim
Highlighted
Craige_Hales
Staff (Retired)

Re: How to append the chart into tabs

cool...hadn't thought about using invisible that way.

Craige
Highlighted
blue1994
Level III

Re: How to append the chart into tabs

Hi,
What i trouble now is when i run the script, it automatic generate out 3 of the charts of 3 different products due to they use the same parameters list from my data table.
So for my case, I need to separate it one by one? After that just append into each tab?
Highlighted
txnelson
Super User

Re: How to append the chart into tabs

Yes, each chart needs to be defined as required.

Jim
Highlighted
blue1994
Level III

Re: How to append the chart into tabs

is there any alternative ways to do it?
Can you give me some hints, what functions can be apply to separate the chart?
I have try using the locate items in a list, then try to append into the tabs, but it seems cannot function.
It still generate out all the 3 charts together when i run the script.
Can you share with me some hints?
Thanks
Highlighted
ian_jmp
Staff

Re: How to append the chart into tabs

Not sure if this gives further help or not. But building on Jim's example above:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

xList = {:height, :weight};
yList = {:height, :weight};

// Create a display window
nw = New Window( "test", tb = Tab Box());

// Loop over the lists
for(x = 1, x <= NItems(xList), x++,
	for(y = 1, y <= NItems(yList), y++,
		// Make a tab box in thw window
		tb << Append("Tab "||Char(x)||Char(y), vlb = VListBox());
		// Create an invisible display
		biv = bivariate( x( xList[x] ), y( yList[y] ), invisible );
		// Move the chart to the tab box
		vlb << append( Report( biv ) );
		// Close the invisible display
		Report(biv) << closeWindow;
	);
);
Highlighted
ausername
Level II

Re: How to append the chart into tabs

When I use this approach the plots are no longer interactive, e.g. I cannot select data points or filter the data with a local data filter. Is this related to report()? Is there another way to append the charts? Thanks!

Highlighted
Craige_Hales
Staff (Retired)

Re: How to append the chart into tabs

Now I see why I hadn't used the "invisible" trick. It really does make a window, and the report attaches to the window. Try this instead:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

xList = {:height, :weight};
yList = {:height, :weight};

// Create a display window
nw = New Window( "test", tb = Tab Box() );

// Loop over the lists
For( x = 1, x <= N Items( xList ), x++,
	For( y = 1, y <= N Items( yList ), y++, 
		// Make a tab box in the window
		tb << Append(
			"Tab " || Char( x ) || Char( y ),
			V List Box( bivariate( x( xList[x] ), y( yList[y] ) ) )
		)
	)
);

When a report is created, it "looks around" to see what it should attach itself to. Usually it doesn't find anything and it makes a new report window and attaches itself to that. "invisible" only makes the window be hidden...it is still being created to anchor the report. Later, the append command looks at the display box (that is anchored in a hidden window) and makes a clone of it, since the same box can't be in two places. Clones are disconnected from the table (and that's how journals are made so they don't depend on a data table). But in this example, the bivariate report looks around and sees it is being created inside a VListBox and doesn't need to make a window. Append then looks at the VListBox and sees it is not attached to anything else and uses it without making a clone. So you wind up with 4 tabs of live reports.

Selection works on live reportSelection works on live report

Craige

View solution in original post

Article Labels

    There are no labels assigned to this post.