<?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 a reference line in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/334846#M58244</link>
    <description>&lt;P&gt;Here is a modification of your script, that sets reference lines for the values of New Cases and New Case Rolling Average based upon the last row's values.&amp;nbsp; This is assuming that the last row in the data table has the latest values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 1245, 660 ),
	Show Control Panel( 0 ),
	Fit to Window( "Maintain Aspect Ratio" ),
	Variables(
		X( :Date ),
		Y( :New Cases ),
		Y( :New Case Rolling Average, Position( 1 ) ),
		Color( :Month )
	),
	Elements(
		Line( X, Y( 1 ), Y( 2 ), Legend( 5 ) ),
		Points( X, Y( 1 ), Y( 2 ), Legend( 6 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"New Cases",
			ScaleBox,
			{Minor Ticks( 1 ), Add Ref Line( 0, "Solid", "Black", "", 1 )}
		)
	)
);

gbrpt = gb &amp;lt;&amp;lt; report;
gbrpt[AxisBox( 2 )] &amp;lt;&amp;lt; add ref line(
	dt:New Cases[N Rows( dt )],
	"Solid",
	"Red",
	"",
	1
);
gbrpt[AxisBox( 2 )] &amp;lt;&amp;lt; add ref line(
	dt:New Case Rolling Average[N Rows( dt )],
	"Solid",
	"Black",
	"",
	1
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Nov 2020 23:29:02 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-11-17T23:29:02Z</dc:date>
    <item>
      <title>Automate a reference line</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/334827#M58243</link>
      <description>&lt;P&gt;As a way to learn JMP and a bit of JSL, I've been keeping track of Covid rates in my state. On a graph with new cases on the y and date on the x, I add a reference line at today's number of new cases as a sort of "we are here." Is there a way to automate this? I can tell that the "12601" and "12381" are the ones that need to change, but I don't know how to tell it to use the most recent values of "New Cases" (red) and "New Cases Rolling Average"(black).&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Size( 1245, 660 ),
	Show Control Panel( 0 ),
	Fit to Window( "Maintain Aspect Ratio" ),
	Variables(
		X( :Date ),
		Y( :New Cases ),
		Y( :New Case Rolling Average, Position( 1 ) ),
		Color( :Month )
	),
	Elements(
		Line( X, Y( 1 ), Y( 2 ), Legend( 5 ) ),
		Points( X, Y( 1 ), Y( 2 ), Legend( 6 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"New Cases",
			ScaleBox,
			{Min( -245.726960373999 ), Max( 19090.397676905 ), Inc( 2000 ),
			Minor Ticks( 1 ), Add Ref Line( 0, "Solid", "Black", "", 1 ),
			Add Ref Line( &lt;FONT color="#FF00FF"&gt;12601&lt;/FONT&gt;, "Solid", "Red", "", 1 ),
			Add Ref Line( &lt;FONT color="#FF00FF"&gt;12381&lt;/FONT&gt;, "Solid", "Black", "", 1 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:08:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/334827#M58243</guid>
      <dc:creator>EMJohnson-Kueny</dc:creator>
      <dc:date>2023-06-11T11:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Automate a reference line</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/334846#M58244</link>
      <description>&lt;P&gt;Here is a modification of your script, that sets reference lines for the values of New Cases and New Case Rolling Average based upon the last row's values.&amp;nbsp; This is assuming that the last row in the data table has the latest values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 1245, 660 ),
	Show Control Panel( 0 ),
	Fit to Window( "Maintain Aspect Ratio" ),
	Variables(
		X( :Date ),
		Y( :New Cases ),
		Y( :New Case Rolling Average, Position( 1 ) ),
		Color( :Month )
	),
	Elements(
		Line( X, Y( 1 ), Y( 2 ), Legend( 5 ) ),
		Points( X, Y( 1 ), Y( 2 ), Legend( 6 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"New Cases",
			ScaleBox,
			{Minor Ticks( 1 ), Add Ref Line( 0, "Solid", "Black", "", 1 )}
		)
	)
);

gbrpt = gb &amp;lt;&amp;lt; report;
gbrpt[AxisBox( 2 )] &amp;lt;&amp;lt; add ref line(
	dt:New Cases[N Rows( dt )],
	"Solid",
	"Red",
	"",
	1
);
gbrpt[AxisBox( 2 )] &amp;lt;&amp;lt; add ref line(
	dt:New Case Rolling Average[N Rows( dt )],
	"Solid",
	"Black",
	"",
	1
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2020 23:29:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/334846#M58244</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-11-17T23:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Automate a reference line</title>
      <link>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/335108#M58266</link>
      <description>&lt;P&gt;Thank you very much, that helps a lot and yes I am adding to the bottom of the table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 16:19:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automate-a-reference-line/m-p/335108#M58266</guid>
      <dc:creator>EMJohnson-Kueny</dc:creator>
      <dc:date>2020-11-18T16:19:07Z</dc:date>
    </item>
  </channel>
</rss>

