To generate Variability Charts based on available Y variables and save them into PNG picturesHi,
I am trying to script some codes which will help me auto generate some variability charts based on the available column names and save them as individual PNG pictures so that I can link the pictures to my powerpoint.
But I am not sure why was the "obj" always undefined during the debug.
Would like to seek some advice on this. Thank you with much appreciation.
- Ann
dt = Open( "D:\My Drive\Program.jmp" );
// Find the Y Columns
numericColNamesList = dt << get column names( string, numeric );
For( i = N Items( numericColNamesList ), i >= 1, i--,
If(
Not(
Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &
Word( 2, numericColNamesList[i], ":" ) != ""
),
numericColNamesList = Remove( numericColNamesList, i, 1 )
)
);
// With varying Y columns and fixed X columns
For( i = 2, i <= N Items( numericColNamesList ), i++,
obj = dt << Variability Chart(
Y( ::Column( numericColNamesList[i] ) ),
X( :code, :lot, :Label, :wafer ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Std Dev Chart( 0 ),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Chart for numericColNamesList[i]"},
"Variability Chart",
FrameBox,
{Marker Size( 6 ), Row Legend(
Label,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
);
obj = List( obj[i] );
For( i = 1, i <= N Items( obj ), i++,
fName = Report( obj )[Outline Box( 1 )] << Get Title;
Report( obj )[Outline Box( 1 )] << Save Picture( "$TEMP/myPics/" || fName || ".png", "PNG" );
Report( obj )[Outline Box( 1 )] << Save Picture( "$TEMP/myPics/" || fName || ".png", "PNG", append );
);
ScriptingRe: To generate Variability Charts based on available Y variables and save them into PNG picturesHi,
I have found the cause of it. The script is able to run now.
However, for variables with " / " in their names (example, A_B/Tox/Cap), the script will prompt error and not able to proceed on.
Report( obj ) << Save Picture( "$TEMP/myPics/" || colList[i] || ".png", PNG);
Is it due to colList[i] ?
Re: To generate Variability Charts based on available Y variables and save them into PNG picturesThanks a lot Jim.
I tried the code, But now I have multiple windows of the Var chart appeared, but none of them were saved as PNG in the designated drive. I guess perhaps I have missed out something near the "save picture" segment.
Re: To generate Variability Charts based on available Y variables and save them into PNG picturesI modified you code. I did not test your code, but I believe it will work. I did not test it.
dt = Open( "D:\My Drive\Program.jmp" );
// Find the Y Columns
numericColNamesList = dt << get column names( string, numeric );
For( i = N Items( numericColNamesList ), i >= 1, i--,
If( Not( Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 & Word( 2, numericColNamesList[i], ":" ) != "" ),
numericColNamesList = Remove( numericColNamesList, i, 1 )
)
);
// With varying Y columns and fixed X columns
For( i = 2, i <= N Items( numericColNamesList ), i++,
obj = dt << Variability Chart(
Y( ::Column( numericColNamesList[i] ) ),
X( :code, :lot, :Label, :wafer ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Std Dev Chart( 0 ),
Automatic Recalc( 1 ),
SendToReport(
Dispatch(
{"Variability Chart for numericColNamesList[i]"},
"Variability Chart",
FrameBox,
{Marker Size( 6 ), Row Legend(
Label,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);
fName = Report( obj )[Outline Box( 1 )] << Get Title;
Report( obj )[Outline Box( 1 )] << Save Picture( "$TEMP/myPics/" || fName || ".png", "PNG", append );
);