Sumando unidad al eje Y de un gráfico de variabilidad.Tengo un conjunto de elementos de prueba de prueba en 80 dispositivos. Estoy trazando el gráfico de variabilidad, quiero agregar la unidad al eje Y. Tengo las unidades en una columna diferente. Nombre de columna es el conjunto de etiquetas predeterminado. ¿Hay alguna manera de agregar las unidades a la etiqueta? ¿Algún script disponible? Se adjunta la hoja de muestra y el formato de muestra de salida que quiero.

Re: Agregando unidad al eje Y de un gráfico de variabilidadGracias @txnelson y @cwillden . Ambos scripts funcionan para la pregunta original.
Gracias,
Venkat
Re: Agregando unidad al eje Y de un gráfico de variabilidadEso es efectivamente lo que estaba pensando para la división. Buen trabajo, Jim.
El enfoque alternativo que estaba considerando evitaría la división y la etiqueta del eje y solo sería unidad. Si falta la unidad, solo pongo "Unidad desconocida" en su lugar, pero puedes hacer lo que quieras allí. Este enfoque crea la parte "SendToByGroup" de la secuencia de comandos. Esto funciona bien con sus datos de muestra:
Names Default to Here(1);
dt = Current Data Table();
/**** Get units for each level of TestInstance ***/
testList = Associative Array(dt:TestInstance) << get keys;
unitList = {};
for(i = 1, i<=N Items(testList), i++,
temp = dt:Unit[min(dt << Get Rows Where(:TestInstance == testList[i]))];
Insert Into(unitList, If(Is Missing(temp),"Unknown Unit", temp ));
);
unitArray = Associative Array(testList, unitList);
/**** Build the Var Chart Script ****/
varChartStr = "Variability Chart(
Y( :value ),
X( :PackageID ),
Std Dev Chart( 0 ),
By( :TestInstance )";
//Loop through levels of TestInstance to add the unit label for the y-axis
for(i=1, i<= N Items(testList), i++,
varChartStr = varChartStr || Eval Insert("\[,
SendToByGroup(
{:TestInstance == "^testList[i]^"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=^testList[i]^",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "^unitArray[testList[i]]^" )}
)
)
)]\");
);
//Close the script
varChartStr = varChartStr || "
);";
//Run the script
eval(parse(varChartStr));
//Add the script to the data table
Eval(Parse(Eval Insert("dt << New Script(\!"Variability Chart\!", ^varChartStr^)")));
Aquí está el resultado:
Re: Agregando unidad al eje Y de un gráfico de variabilidadAquí hay un script que produce lo que desea al agregar las Unidades al nombre de las Pruebas. Corrí esto contra el archivo de Excel que fue suministrado. El script asume que la tabla de datos se ha abierto en JMP antes de ejecutar el script.
Names Default To Here( 1 );
// This script assumes you have opened the Excel file as a JMP Data Table
dt = Current Data Table();
// Split the data into the proper form for analysis
dtSplit = dt << Split( Split By( :TestInstance ), Split( :value ), Remaining Columns( Drop( :Unit ) ), Sort by Column Property );
// Create a data table to determine the units for each test
dtUnits = dt << Summary( Group( :TestInstance, :Unit ), Freq( "None" ), Weight( "None" ), Link to original data table( 0 ) );
// Loop across the data table and add the Units to the different Test Columns in the data table
For( i = 1, i <= N Rows( dtUnits ), i++,
If( dtUnits:Unit[i] != "",
Column( dtSplit, dtUnits:TestInstance[i] ) << set name(
Column( dtSplit, dtUnits:TestInstance[i] ) << get name || " ( " || dtUnits:Unit[i] || " )"
)
)
);
// Delete the Units data table since it is no longer needed
close( dtUnits, nosave );
// Create a window to place all of the charts into
nw = New Window( "Variability Chart by PackageID", vlb = V List Box() );
// Get all of the column names
colNames = dtSplit << get column names( string, numeric );
// Loop across all of the columns and when a Test column is found,
// then create a chart for it
For( i = 1, i <= N Items( colNames ), i++,
If( Contains( colNames[i], "Test" ) == 1,
testList = ":Name(\!"" || colNames[i] || "\!")";
Eval(
Substitute(
Expr(
vlb << append( dtSplit << Variability Chart( Y( __theList__ ), X( :PackageID ), Std Dev Chart( 0 ) ) )
),
Expr( __theList__ ), Parse( testList )
)
);
)
);
Re: Agregando unidad al eje Y de un gráfico de variabilidad @cwillden Gracias, transpongo la hoja que se muestra en el formato adjunto. Por favor, muéstrame la manera de agregar la unidad.
Gracias
Re: Agregando unidad al eje Y de un gráfico de variabilidadCreo que sería más fácil en un formato más amplio (es decir, dividir la columna "valor" en TestInstance), pero si desea mantenerlo en el formato largo, el enfoque más directo podría ser construir las partes de SendToByGroup () en un bucle y agarrando la unidad para cada nivel de grupo. Ciertamente puedo ayudarte con eso más tarde esta noche, pero tengo que correr ahora mismo.
Re: Agregando unidad al eje Y de un gráfico de variabilidadGracias @cwillden pero tengo más de 200 elementos de prueba, por lo que este método puede no ser adecuado para ese gran conjunto de elementos de prueba. ¿Tienes alguna idea de usarlo con el bucle?
Gracias.
Re: Agregando unidad al eje Y de un gráfico de variabilidadSi tiene que hacer esto una vez, simplemente haga clic en las etiquetas del eje y escriba lo que desee. Si tiene que hacer esto repetidamente, escriba lo que desea y guarde el script. Apunte este script a cualquier tabla futura:
Variability Chart(
SendToByGroup( {:TestInstance == "Test1"} ),
Y( :value ),
SendToByGroup( {:TestInstance == "Test1"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test2"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test3"}, Y( :value ) ),
SendToByGroup( {:TestInstance == "Test4"}, Y( :value ) ),
X( :PackageID ),
Std Dev Chart( 0 ),
By( :TestInstance ),
SendToByGroup(
{:TestInstance == "Test1"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test1",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "Unknown" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test2"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test2",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "mA" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test3"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test3",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "uA" )}
)
)
),
SendToByGroup(
{:TestInstance == "Test4"},
SendToReport(
Dispatch(
{"Variability Gauge TestInstance=Test4",
"Variability Chart for value"},
"value",
TextEditBox,
{Set Text( "mA" )}
)
)
)
)