Choose Language Hide Translation Bar
Highlighted
Occasional Contributor

## Legend not showing up saved PNG

dt = Open( "\\someFile.jmp", invisible);

path = "\\path\to\folder\";

names = { "Amplitude 1/2 Vppse", "Amplitude Vppde"};

ngraphs = N Items( names );

For( ip = 1, ip <= ngraphs, ip++,

current_graph = dt << Variability Chart(
invisible,
Y( Column(dt, names[ip])),
X( :Temp, :vccl),
Std Dev Chart( 0 ),
SendToReport(
Dispatch(
{"Variability Chart for " || names[ip]},
"2",
ScaleBox,
{Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
),
Dispatch(
{"Variability Chart for " || names[ip]},
"Variability Chart",
FrameBox,
{Row Legend(
Serial,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Standard" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);

current_graph rep = current_graph << Report;

chart_type = Char(current_graph << Title);
chart_type = Munger(chart_type, 1, "[]", "");

If(chart_type == "Variability Chart", name = current_graph rep[TextEditBox(1)] << Get Text );

name = Munger(name,1,"/", "_");

final_name = chart_type || "_" || name ;

picture_path = path || Char(final_name) || ".png";
current_graph << Save Picture( picture_path, "png" );
)

Help! So I have managed to make a for loop to make a graph for each column that I put in my array. This actually works :)
BUT, it looks like the legend does not show up even though I have it in the script.
I also notice that in a blank jmp file that just has data and no scripts that run, my data points are just black dots instead of the colored markers I have specified in my script. Is this connected? Do I have to run a script in the data set, and then run the whole .jsl script like the one above after? Why isn't my legend showing up the way I have it specified in my script.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

## Re: Legend not showing up saved PNG

I should have said that you can avoid both SendToReport and Dispatch.  Each Dispatch command essentially identifies a display box and sends it a message.  After the platform launches, your two commands would become:

current_graph rep[Scale Box(2)] << Label Row(...);current_graph rep[Frame Box(1)] << Row Legend(...);

6 REPLIES 6
Highlighted
Staff

## Re: Legend not showing up saved PNG

A similar script worked for me with sample data.  Are you trying to color by the "Serial" column, or by the measurement column?

Highlighted
Occasional Contributor

## Re: Legend not showing up saved PNG

by the serial. I have multiple parts that had several tests run on them. I want to see the serial number in a color and marker as shown in my script. I'll add a picture to my original post to show the results
Highlighted
Staff

## Re: Legend not showing up saved PNG

Ok, it appears that the issue when doing this within a loop is that the Dispatch() statement cannot take an expression like ("Variability Chart for " || names[ip]).  I think you will be better off not using SendToReport and instead add:

current_graph rep[Frame Box(1)] << Row Legend(...)

Highlighted
Occasional Contributor

## Re: Legend not showing up saved PNG

How exactly would I do that when I have two Dispatch inside of the SendToReport? Or do I do it twice like the code below?

current_graph rep[Frame Box(1)] <<
Dispatch(
{"Variability Chart for " || names[ip]},
"2",
ScaleBox,
{Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
),current_graph rep[Frame Box(1)] <<
Dispatch(
{"Variability Chart for " || names[ip]},
"Variability Chart",
FrameBox,
{Row Legend(
Serial,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Standard" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
);
Highlighted
Staff

## Re: Legend not showing up saved PNG

I should have said that you can avoid both SendToReport and Dispatch.  Each Dispatch command essentially identifies a display box and sends it a message.  After the platform launches, your two commands would become:

current_graph rep[Scale Box(2)] << Label Row(...);current_graph rep[Frame Box(1)] << Row Legend(...);

Highlighted
Occasional Contributor

## Re: Legend not showing up saved PNG

Thanks! At first it wasn't working, but I added

current_graph rep = current_graph << Report;

before the Frame Box and Scale Box, and it seemed to do the trick. Thank you!!!!!!!!