<?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: Automate Reference Line Based on Column Data in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415079#M66416</link>
    <description>&lt;P&gt;Given your current data structure, here is one way of automating your Historical Signals&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
targ1 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 1" )] );
targ2 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 2" )] );
targ3 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 3" )] );
Variability Chart(
	Y( :Signal ),
	X( :Zone, :Target, :Condition ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Show Range Bars( 0 ),
	Show Cell Means( 0 ),
	Std Dev Chart( 0 ),
	Mean Diamonds( 1 ),
	SendToReport(
		Dispatch(
			{"Variability Chart for Signal"},
			"Variability Chart",
			FrameBox,
			{Frame Size( 969, 240 ), Add Graphics Script(
				2,
				Description( "" ),
				Pen Color( "RED" );
				//Target 2
				H Line( 0, 2, targ2 );
				//Target 3
				H Line( 2, 4, targ3 );
				//Target 1
				H Line( 4, 6, targ1 );
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Sep 2021 00:17:04 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-09-03T00:17:04Z</dc:date>
    <item>
      <title>Automate Reference Line Based on Column Data</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415055#M66414</link>
      <description>&lt;P&gt;Hello, I am very new to JSL and am struggling to think of a way to automatically create multiple reference lines in a graph based on values in a specific column. Currently, I am graphing one variable (:Signal) on the Y axis, and three variables (:Zone, :Target, and :Condition) on the X axis. Each (:Target) variable has a specific (:historical signal) and I would like to find a way to automatically graph a (:Target)'s (:historical signal) as a reference line. The code I have is done by manually adding the historical signal value via h line(), but ideally the script would add a reference line for each (:target) based on its corresponding historical signal. Thank you!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Variability Chart(
	Y( :Signal ),
	X( :Zone, :Target, :Condition ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Show Range Bars( 0 ),
	Show Cell Means( 0 ),
	Std Dev Chart( 0 ),
	Mean Diamonds( 1 ),
	SendToReport(
		Dispatch(
			{"Variability Chart for Signal"},
			"Variability Chart",
			FrameBox,
			{Frame Size( 969, 240 ),
			Add Graphics Script(
				2,
				Description( "" ),
				Pen Color( "RED" );
				//Target 2
				H Line( 0, 2, 234 );
				//Target 3
				H Line( 2, 4, 670 );
				//Target 1
				H Line( 4, 6, 463 );
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:55:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415055#M66414</guid>
      <dc:creator>mthacker477</dc:creator>
      <dc:date>2023-06-09T19:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Reference Line Based on Column Data</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415079#M66416</link>
      <description>&lt;P&gt;Given your current data structure, here is one way of automating your Historical Signals&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
targ1 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 1" )] );
targ2 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 2" )] );
targ3 = Mean( :Historical Signal[dt &amp;lt;&amp;lt; get rows where( :Target == "Target 3" )] );
Variability Chart(
	Y( :Signal ),
	X( :Zone, :Target, :Condition ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Show Range Bars( 0 ),
	Show Cell Means( 0 ),
	Std Dev Chart( 0 ),
	Mean Diamonds( 1 ),
	SendToReport(
		Dispatch(
			{"Variability Chart for Signal"},
			"Variability Chart",
			FrameBox,
			{Frame Size( 969, 240 ), Add Graphics Script(
				2,
				Description( "" ),
				Pen Color( "RED" );
				//Target 2
				H Line( 0, 2, targ2 );
				//Target 3
				H Line( 2, 4, targ3 );
				//Target 1
				H Line( 4, 6, targ1 );
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Sep 2021 00:17:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415079#M66416</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-03T00:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Reference Line Based on Column Data</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415357#M66445</link>
      <description>&lt;P&gt;Hey txnelson, thank you so much for your response, this is almost exactly what I am looking for! The only other thing I am wondering is if it is possible to have the h line() code match with its corresponding :Target instead of having to manually enter the coordinates on the graph. In the future, I am going to be adding differing amounts of targets and they will not always be in the same order.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 16:22:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415357#M66445</guid>
      <dc:creator>mthacker477</dc:creator>
      <dc:date>2021-09-03T16:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Reference Line Based on Column Data</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415516#M66456</link>
      <description>&lt;P&gt;All that needs to be done, is to figure out how to get the values and the order, and then generate the required JSL.&amp;nbsp; Here is a simple example that should give you a start in the right direction to create your final script.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Find the number of targets and get the means
Summarize( dt, targs = by( :Zone, :Target ), targMeans = Mean( :Historical Signal ) );

vc = Variability Chart(
	Y( :Signal ),
	X( :Zone, :Target, :Condition ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Show Range Bars( 0 ),
	Show Cell Means( 0 ),
	Std Dev Chart( 0 ),
	Mean Diamonds( 1 )
);

// Create the JSL to submit to generate the Target Lines
theExpr =
"Report( vc )[FrameBox( 1 )] &amp;lt;&amp;lt; add graphics Script(
		Description( \!"\!" ),
		Pen Color( \!"RED\!" );";
For( ii = 1, ii &amp;lt;= N Items( targMeans ), ii++,
	theExpr = theExpr || "H Line( " || Char( (ii - 1) * 2 ) || "," || Char( (ii - 1) * 2 + 2 )
	 || "," || Char( targMeans[ii] ) || ");";
		
);
Eval( Parse( theExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Sep 2021 01:41:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-Reference-Line-Based-on-Column-Data/m-p/415516#M66456</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-04T01:41:23Z</dc:date>
    </item>
  </channel>
</rss>

