<?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 Adding Text with statistic summary and automatic positioning under box plot in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639829#M83739</link>
    <description>&lt;P&gt;Hi, I have created graph builder with generated script as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Transform Column( "Unit Number", Nominal, Formula( Char( :"Unit S/N"n ) ) ),
	Size( 570, 817 ),
	Show Legend( 0 ),
	Variables( X( :Unit Number ), Y( :Bounding_Circle_Diameter um ) ),
	Elements( Box Plot( X, Y, Legend( 6 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Param Name ),
			Where( :Param Name == "Fuiyoh" ),
			Display( :Param Name, N Items( 3 ), "List Display" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Bounding_Circle_Diameter um",
			ScaleBox,
			{Min( 1500 ), Max( 5000 ), Inc( 500 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text( "Bounding_Circle_Diameter um (Fuiyoh)" ), Set Font Size( 20 )}
		),
		Dispatch( {}, "X title", TextEditBox, {Set Font Size( 18 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 18 )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Reference Line Order( 6 ),
			Add Graphics Script(
				2,
				Description( "" ),
				Text( Center Justified, {0, 2150}, "Range: 44.4638" );
				Text( Center Justified, {0, 2050}, "Mean: 2288.48" );
				Text( Center Justified, {1, 2500}, "Range: 136.315" );
				Text( Center Justified, {1, 2400}, "Mean: 2681.81" );
				Text( Center Justified, {2, 2100}, "Range: 97.6151" );
				Text( Center Justified, {2, 2000}, "Mean: 2278.41" );
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But the text and positions were created manually with hard coded values. As it can be seen the data is filtered with a certain column values. Is there any way I could replace those hard coded values with the statistics from the data respectively?&lt;BR /&gt;Text Y position -&amp;gt; from Min values of the data subset&lt;BR /&gt;Mean -&amp;gt; average value from data subset&lt;BR /&gt;range -&amp;gt; Max - Min from data subset&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2023 12:58:00 GMT</pubDate>
    <dc:creator>nandha_handharu</dc:creator>
    <dc:date>2023-06-07T12:58:00Z</dc:date>
    <item>
      <title>Adding Text with statistic summary and automatic positioning under box plot</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639829#M83739</link>
      <description>&lt;P&gt;Hi, I have created graph builder with generated script as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Transform Column( "Unit Number", Nominal, Formula( Char( :"Unit S/N"n ) ) ),
	Size( 570, 817 ),
	Show Legend( 0 ),
	Variables( X( :Unit Number ), Y( :Bounding_Circle_Diameter um ) ),
	Elements( Box Plot( X, Y, Legend( 6 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Param Name ),
			Where( :Param Name == "Fuiyoh" ),
			Display( :Param Name, N Items( 3 ), "List Display" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Bounding_Circle_Diameter um",
			ScaleBox,
			{Min( 1500 ), Max( 5000 ), Inc( 500 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text( "Bounding_Circle_Diameter um (Fuiyoh)" ), Set Font Size( 20 )}
		),
		Dispatch( {}, "X title", TextEditBox, {Set Font Size( 18 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 18 )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Reference Line Order( 6 ),
			Add Graphics Script(
				2,
				Description( "" ),
				Text( Center Justified, {0, 2150}, "Range: 44.4638" );
				Text( Center Justified, {0, 2050}, "Mean: 2288.48" );
				Text( Center Justified, {1, 2500}, "Range: 136.315" );
				Text( Center Justified, {1, 2400}, "Mean: 2681.81" );
				Text( Center Justified, {2, 2100}, "Range: 97.6151" );
				Text( Center Justified, {2, 2000}, "Mean: 2278.41" );
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But the text and positions were created manually with hard coded values. As it can be seen the data is filtered with a certain column values. Is there any way I could replace those hard coded values with the statistics from the data respectively?&lt;BR /&gt;Text Y position -&amp;gt; from Min values of the data subset&lt;BR /&gt;Mean -&amp;gt; average value from data subset&lt;BR /&gt;range -&amp;gt; Max - Min from data subset&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 12:58:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639829#M83739</guid>
      <dc:creator>nandha_handharu</dc:creator>
      <dc:date>2023-06-07T12:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Text with statistic summary and automatic positioning under box plot</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639880#M83741</link>
      <description>&lt;P&gt;The Caption element can automatically update the stats as the filter is applied, and it has a few options for where to place the stats.&amp;nbsp; If you are using JMP 17 one of the options is to place the stats in a table below the axis.&amp;nbsp; Retaining the custom placement would likely require that you implement a JSL row-state handler to compute and replace the stats via script.&lt;/P&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="danschikore_0-1686143485767.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/53482i2F49AE2120B55ED4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danschikore_0-1686143485767.png" alt="danschikore_0-1686143485767.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt &amp;lt;&amp;lt; Graph Builder(
	Size( 528, 464 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ) ),
	Elements(
		Box Plot( X, Y, Legend( 6 ) ),
		Caption Box(
			X,
			Y,
			Legend( 7 ),
			Summary Statistic( "Mean" ),
			Summary Statistic 2( "Range" ),
			Location( "Axis Table" )
		)
	),
	Local Data Filter( Add Filter( columns( :sex ), Where( :sex == "M" ) ) )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 13:13:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639880#M83741</guid>
      <dc:creator>danschikore</dc:creator>
      <dc:date>2023-06-07T13:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Text with statistic summary and automatic positioning under box plot</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639921#M83744</link>
      <description>&lt;P&gt;There is a better methodology to use to add graphics output to a graph.&amp;nbsp; Take a look at the example script below to see how to dynamically determine where and what to display on a graph.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1686148237919.png" style="width: 638px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/53490iE8D7C2C505087363/image-dimensions/638x590?v=v2" width="638" height="590" role="button" title="txnelson_0-1686148237919.png" alt="txnelson_0-1686148237919.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );

// Create the graph
gb = Graph Builder(
	Size( 528, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);

// Access the report output
rgb = gb &amp;lt;&amp;lt; report;

// Add a graphics script to the report output
rgb[framebox( 1 )] &amp;lt;&amp;lt; add graphics script(

// Find the parametrics of the displayed graph
	xMaxAxis = rgb[AxisBox( 1 )] &amp;lt;&amp;lt; get max;
	xMinAxis = rgb[AxisBox( 1 )] &amp;lt;&amp;lt; get min;
	yMaxAxis = rgb[AxisBox( 2 )] &amp;lt;&amp;lt; get max;
	yMinAxis = rgb[AxisBox( 2 )] &amp;lt;&amp;lt; get min;
	
	// Calculate the desired column stats
	heightMean = Col Mean( :height );
	heightRange = Col Max( :height ) - Col Min( :height );
	
	// Calculate the xy position on the graph to display the text
	pos = As List(
		Matrix( (xMinAxis + .1 * (xMaxAxis - xMinAxis)) |/ (yMaxAxis - .1 * (yMaxAxis - yMinaxis)) )
	);

	// Write out the text
	Text( Center Justified, pos, "Mean: " || Format( heightMean, "fixed dec", 7, , 2 ) );
	
	// Change the display position for the next line to be displayed
	pos[2] = pos[2] - .05 * (yMaxAxis - yMinaxis);
	
	// Write out the new line
	Text( Center Justified, pos, "Range: " || Format( heightMean, "fixed dec", 7, , 2 ) );
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 14:31:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/639921#M83744</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-06-07T14:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Text with statistic summary and automatic positioning under box plot</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/640445#M83780</link>
      <description>&lt;P&gt;A few points about using a graphics script:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The graphics script computation will occur at every refresh of the screen&lt;/LI&gt;
&lt;LI&gt;The computation is not using the row-states, so it will still have issues with filters&lt;/LI&gt;
&lt;LI&gt;If you save the script from the platform and rerun it later, it will not work because it is not self-contained.&amp;nbsp; This also affects saving in a Workflow, Project, Dashboard, or to a JRP file.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:49:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Text-with-statistic-summary-and-automatic-positioning/m-p/640445#M83780</guid>
      <dc:creator>danschikore</dc:creator>
      <dc:date>2023-06-08T16:49:55Z</dc:date>
    </item>
  </channel>
</rss>

