¿Puedo configurar el título del generador de gráficos según la variable de un cuadro de lista H?Tengo una ventana de cuadro de lista H en la que los usuarios pueden ingresar parámetros, después de eso haré algunos cálculos y proporcionaré un generador de gráficos al usuario.
Mi pregunta es ¿puedo configurar el título del generador de gráficos también en función de los parámetros del cuadro de lista H?a continuación se muestra el código de muestra
Names Default To Here( 1 );
dt = current data table();
nw = New Window( "simulator",
H List Box( Text Box( " Input sample rate " ), sample rate = Number Edit Box() ),
H List Box( Text Box( " Input threshold " ), threshold = Number Edit Box() ),
Button Box( "OK",
thesamplerate = sample rate << get;
thethreshold = threshold << get;
numthreshold = num(thethreshold);
numtime = num(thetime);
//Here are more code I already finished based on above variable
Graph Builder(
Variables( X( :File Name ), Y( :greater ) ),
Elements( Bar( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Sample rate = Threshold = " )} //I want to have sample rate & threshold shown on title
)
)
)
))
Automatización y secuencias de comandosRe: ¿Puedo configurar el título del generador de gráficos según la variable de un cuadro de lista H?Este es el método que uso normalmente:
Names Default To Here( 1 );
dt = Current Data Table();
nw = New Window( "simulator",
H List Box( Text Box( " Input sample rate " ), sample rate = Number Edit Box() ),
H List Box( Text Box( " Input threshold " ), threshold = Number Edit Box() ),
Button Box( "OK",
thesamplerate = sample rate << get;
thethreshold = threshold << get;
numthreshold = Num( thethreshold );
numtime = Num( thetime );
//Here are more code I already finished based on above variable
gb = Graph Builder( Variables( X( :File Name ), Y( :greater ) ), Elements( Bar( X, Y, Legend( 4 ) ) ) );
// Set the title
Report( gb )[Outline Box( 1 ), Text Edit Box( 1 )] << set text( "Sample Rate=" || Char( thesamplerate ) );
)
);Re: ¿Puedo configurar el título del generador de gráficos según la variable de un cuadro de lista H?Podrías crear el título usando Eval Insert o concatenación de cadenas.
Aquí hay una opción
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
nw = New Window("simulator",
H List Box(Text Box(" Input sample rate "), sample rate = Number Edit Box()),
H List Box(Text Box(" Input threshold "), threshold = Number Edit Box()),
Button Box("OK",
thesamplerate = sample rate << get;
thethreshold = threshold << get;
//numthreshold = Num(thethreshold);
//numtime = Num(thetime);
gb = dt << Graph Builder(
Variables(X(:age), Y(:weight)),
Elements(Bar(X, Y, Legend(4)))
);
Report(gb)[TextEditBox(1)] << Set Text(Eval Insert("Sample rate = ^thesamplerate^ Threshold = ^thethreshold^"));
)
);
También debería poder insertarlo directamente en el título en SendToReport. Aquí también construyo la variable de título por separado, pero no es necesario, pero puede facilitar la depuración y demás.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
nw = New Window("simulator",
H List Box(Text Box(" Input sample rate "), sample rate = Number Edit Box()),
H List Box(Text Box(" Input threshold "), threshold = Number Edit Box()),
Button Box("OK",
thesamplerate = sample rate << get;
thethreshold = threshold << get;
//numthreshold = Num(thethreshold);
//numtime = Num(thetime);
graph_title = Eval Insert("Sample rate = ^thesamplerate^ Threshold = ^thethreshold^");
gb = dt << Graph Builder(
Variables(X(:age), Y(:weight)),
Elements(Bar(X, Y, Legend(4))),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text(graph_title)} //I want to have sample rate & threshold shown on title
)
)
);
)
);Re: ¿Puedo configurar el título del generador de gráficos según la variable de un cuadro de lista H?Gracias a ambos por su pronta respuesta.