Control del tamaño y la posición de las anotaciones de texto: necesito ayudaTodo,
Necesito colocar varias anotaciones de texto en un gráfico.
Son etiquetas de una sola línea, pero de distinta longitud. Por eso tengo que usar Fixed Size(0) para ajustar la longitud de la etiqueta al texto.
Pero al hacerlo, también ajusta el tamaño vertical y coloca el texto demasiado alto, lo cual, por alguna razón, me molesta mucho (gráfico de la izquierda). Si configuro Tamaño fijo (1), puedo controlar el tamaño de la etiqueta directamente y la posición del texto se ve bien (gráfico de la derecha), pero tengo texto de diferente longitud; o la etiqueta es demasiado larga, o si el texto sobrepasa el tamaño de la etiqueta, se ajusta automáticamente al comportamiento de "Tamaño fijo (0)", lo que se ve muy mal.


¿Alguna idea de cómo ajustar la posición del texto dentro de la etiqueta Y usar Tamaño fijo(0)?
<< La alineación vertical ("inferior") no funciona.
Aquí está el código:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 20;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
<BR /> <BR />
<LINGO-LABS id="lingo-labs-913210" slang="en-US" mode="CREATE">
<LINGO-LABEL>Automatización y scripting</LINGO-LABEL>
</LINGO-LABS>
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaNo estoy seguro de si eso se puede controlar en la anotación de texto a menos que calcules tú mismo el tamaño del cuadro de texto.
¿Podrías utilizar Graphic Script?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << bivariate(y(:weight), x(:height));
rbiv = biv << report;
fb = rbiv[FrameBox(1)];
fb << Add Graphics Script(
Back Color("Light Yellow");
Text Color("Red");
Text(Erased, {50, 150}, "We need to discuss this at the next meeting.");
Text(Erased, {50, 135}, "We need to discuss this at the next");
);
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaEl problema con el script Add Graphics es que la posición del texto se especifica en coordenadas reales del gráfico. En mi caso, puede ser cualquiera, desde 1e-07 hasta más de 9000 
Podría interesarme escribir una función para calcular valores para las posiciones que necesito, pero solo si puedo añadir un borde o marco alrededor del texto, como en el primer ejemplo. El gráfico puede resultar bastante complejo; necesito separarlo visualmente para facilitar su lectura y eliminación.
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaSe me ocurrió una idea.
¿Qué sucede si primero dibujo anotaciones de texto con Tamaño fijo (0), mido la longitud, luego las cambio a Tamaño fijo (1) y establezco manualmente el ancho medido y la altura deseada?
El problema es que << Get Size() devuelve algunos valores erróneos:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 40;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
<P>Produce:</P> //:*/
Show(ta1_x, ta2_x);
/*:
ta1_x = 328;
ta2_x = 328;
Aunque las etiquetas tienen longitudes visiblemente diferentes en el gráfico, ¿me estoy perdiendo algo?
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaPrueba a usar < <>
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaTambién puedes comprobar el tamaño con un cuadro de texto en una ventana nueva.
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 20;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
nw = new window("", << Window View("Invisible"),
tb1 = Text Box("We need to discuss this at the next meeting."),
tb2 = Text Box("We need to discuss this at the next ")
);
w1 = tb1 << Get Size;
w2 = tb2 << Get Size;
nw << close window;
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, w1[1]+20+70, 80+taHeight});
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, w2[1]+20+70, 120+taHeight});
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaGracias por el consejo, sí, ahora puedo obtener y configurar los tamaños de la etiqueta.
El problema es que JSL no procesa línea por línea, sino que calcula el estado final para cada propiedad por separado... y luego lo aplica.
Como:
...
...
ta1<
<FIXED size=""></FIXED>
<P>Entonces, el ancho sigue siendo el que configuré inicialmente:</P> <CODE class=" language-jsl">ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
Agregar Wait(0.5) ayudó a superar ese problema.
El guion final es el siguiente:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 40;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )<
<FIXED size=""></FIXED> <BR />
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaEsta también funciona. Subjetivamente, incluso más rápida que mi solución. Estoy intentando medirla con la herramienta de depuración.
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaConfigurar Wait(0) acelera las cosas: ahora hay una espera real, pero la pantalla se vuelve a dibujar.
Re: Control del tamaño y la posición de las anotaciones de texto: necesito ayudaNo importa, funciona.
Antes de los bucles:
taList = {};
Dentro del bucle:
Insert Into(taList, ta);
Después de los bucles:
Wait(0);
taList << Fixed Size(1);
For Each({height, index}, taList << Get Height(),
taList[index] << Set Height(height*0.93)
);
El problema ahora es que, al implementar esto en un escenario real, cuando tengo múltiples gráficos con múltiples anotaciones de texto, realizar este truco con cada anotación en un bucle de dos niveles resulta demasiado lento.
Intenté crear una lista de anotaciones de texto:
taList={};
y luego, justo dentro de los bucles, añadir el ta actual a la lista:
Insert Into(taList, ta);
Al final de los bucles tengo:
taList
/*:
{DisplayBox[gtext], DisplayBox[gtext],......}
Pero las operaciones sobre esta lista o miembros individuales no funcionan.
¿Alguna idea? Las mías son:
1. Intenta usar el cuadro de contexto para separar las variables entre diferentes tareas.
2. De alguna manera, extraer esas anotaciones del informe; pero cuando extraigo XML (<