<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add Text to a graph box in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/456994#M70220</link>
    <description>&lt;P&gt;Depending on the goal, you might be able to use a data table and an existing platform and just label the points with another column. One of the column attributes is Use For Marker.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UseForMarker circled in red." style="width: 784px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39590i23F1F69709F4EF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="UseForMarker.PNG" alt="UseForMarker circled in red." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;UseForMarker circled in red.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But to do what you describe, the graphics script needs to have a loop that gets labels (and color and marker data) from a container of some sort. The container can be a list, a data table, or an associative array. If you add a label to the container, you can send the &amp;lt;&amp;lt;inval message to the graph to make it redraw. When it redraws, the graphics script will process all the labels from the container.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {{"aaa", 10, 10, "red"}};
New Window( "Example",
    gb=Graph Box(
        For( i = 1, i &amp;lt;= N Items( list ), i += 1,
            thisLabel = list[i];
            Text Color( thisLabel[4] );
            Text( Center Justified, {thisLabel[2], thisLabel[3]}, thisLabel[1] );
        )
    )
);
wait(1);
list[2] = {"bbb",20,20,"blue"};
gb&amp;lt;&amp;lt;inval;
wait(1);
list[3] = {"ccc",30,30,"green"};
gb&amp;lt;&amp;lt;inval;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Three seconds later..." style="width: 420px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39589i59406A186F569926/image-size/large?v=v2&amp;amp;px=999" role="button" title="AddingText.PNG" alt="Three seconds later..." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Three seconds later...&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jan 2022 03:04:26 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2022-01-29T03:04:26Z</dc:date>
    <item>
      <title>Add Text to a graph box</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/456981#M70219</link>
      <description>&lt;P&gt;I can add formatted text at a specific coordinate using the code below at the time of making the Graph box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Window( "Example",
	Graph Box(
		Text Size( 20 );
		Text( {50, 20}, "label" );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thickey_0-1643420330974.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39588i859602BAD7622ACE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="thickey_0-1643420330974.png" alt="thickey_0-1643420330974.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I can't seem to figure out how to add text later, after the Graph Box has been created. For example I am actually trying to add multiple formatted text items to the graph box in a for loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried by identifying the 'inner frame box' for the 'graph box' and adding the text to it, but the frame box does not recognize the 'Text' message.&amp;nbsp; Ultimately, I want to be able to add multiple formatted text items at specific coordinates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example", a = Graph Box() );
frame = a[FrameBox( 1 )];
frame &amp;lt;&amp;lt; Text Color( "red" );
frame &amp;lt;&amp;lt; Text( Center Justified, {50, 20}, "centered" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers, Troy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:21:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/456981#M70219</guid>
      <dc:creator>thickey</dc:creator>
      <dc:date>2023-06-11T11:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add Text to a graph box</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/456994#M70220</link>
      <description>&lt;P&gt;Depending on the goal, you might be able to use a data table and an existing platform and just label the points with another column. One of the column attributes is Use For Marker.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UseForMarker circled in red." style="width: 784px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39590i23F1F69709F4EF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="UseForMarker.PNG" alt="UseForMarker circled in red." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;UseForMarker circled in red.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But to do what you describe, the graphics script needs to have a loop that gets labels (and color and marker data) from a container of some sort. The container can be a list, a data table, or an associative array. If you add a label to the container, you can send the &amp;lt;&amp;lt;inval message to the graph to make it redraw. When it redraws, the graphics script will process all the labels from the container.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {{"aaa", 10, 10, "red"}};
New Window( "Example",
    gb=Graph Box(
        For( i = 1, i &amp;lt;= N Items( list ), i += 1,
            thisLabel = list[i];
            Text Color( thisLabel[4] );
            Text( Center Justified, {thisLabel[2], thisLabel[3]}, thisLabel[1] );
        )
    )
);
wait(1);
list[2] = {"bbb",20,20,"blue"};
gb&amp;lt;&amp;lt;inval;
wait(1);
list[3] = {"ccc",30,30,"green"};
gb&amp;lt;&amp;lt;inval;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Three seconds later..." style="width: 420px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39589i59406A186F569926/image-size/large?v=v2&amp;amp;px=999" role="button" title="AddingText.PNG" alt="Three seconds later..." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Three seconds later...&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 03:04:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/456994#M70220</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-01-29T03:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add Text to a graph box</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457020#M70221</link>
      <description>&lt;P&gt;Awesome Craige.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I usually make all of my GUI Items up front and send messages to them later in the 'Logic' Part of my applications. Of course, I can just move the main loop INTO the graph box when I make it. That would work pretty well I suspect.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll go give these two approaches a go and see how I get on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Incidentally, I'm using the graph box purely for making an Image (die partition map in this case) - I don't have any 'data' associated with this like I would when I use a bivariate or graphbuilder platform for analysis.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 13:22:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457020#M70221</guid>
      <dc:creator>thickey</dc:creator>
      <dc:date>2022-01-29T13:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add Text to a graph box</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457064#M70225</link>
      <description>&lt;P&gt;Notice how the final &lt;CODE class=" language-jsl"&gt;Glue()&lt;/CODE&gt; statement in the &lt;CODE class=" language-jsl"&gt;Graph Box()&lt;/CODE&gt; function is a script as shown in the help index (see below).&amp;nbsp; To add a script to a graph box after-the-fact, use the &lt;CODE class=" language-jsl"&gt;&amp;lt;&amp;lt;Add Graphics Script&lt;/CODE&gt; method, as below.&amp;nbsp; You can put a &lt;CODE class=" language-jsl"&gt;Glue()&lt;/CODE&gt; function here as I've done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example", a = Graph Box() );
frame = a[FrameBox( 1 )];
frame &amp;lt;&amp;lt; Add Graphics Script( Text Color( "red" ); Text( Center Justified, {50, 20}, "centered" ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ErraticAttach_0-1643487721257.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/39593iC34FB4416150139D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ErraticAttach_0-1643487721257.png" alt="ErraticAttach_0-1643487721257.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2022 20:24:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457064#M70225</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2022-01-29T20:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add Text to a graph box</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457074#M70227</link>
      <description>&lt;P&gt;Oh man, both solutions work but I ultimately went for ErraticAttach method as it is closer to my original requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to both of you for your responses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 00:20:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Text-to-a-graph-box/m-p/457074#M70227</guid>
      <dc:creator>thickey</dc:creator>
      <dc:date>2022-01-30T00:20:18Z</dc:date>
    </item>
  </channel>
</rss>

