<?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: One chart with Different Reference Lines for Different Products in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753612#M93543</link>
    <description>&lt;P&gt;Not being a scripter, I tried something different.&amp;nbsp; In the attached I created a column for "new product" in Table 2, and then joined the tables using Product as the key.&amp;nbsp; The stored graph from Graph Builder colored the points by the Design Name, used Product in the Group X field, and selected both Date and Design Change Dates as X variables with Yield as Y.&amp;nbsp; I modified the marker size.&amp;nbsp; I think more could be done to improve the display (at least move PM3 to the right since it had no design changes).&lt;/P&gt;</description>
    <pubDate>Sat, 11 May 2024 19:15:00 GMT</pubDate>
    <dc:creator>dlehman1</dc:creator>
    <dc:date>2024-05-11T19:15:00Z</dc:date>
    <item>
      <title>One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753537#M93531</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Attached is a table1.jmp with 3 columns that I will use to plot a chart. Table2 is a table with Reference Lines information. Also attached is the output_chart.png that I am trying to accomplish. Is it possible to write a jsl to plot a chart and input the reference lines information that are different for different product. I also won't mind any other way to plot the chart. Any help is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2024 05:25:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753537#M93531</guid>
      <dc:creator>cchueng</dc:creator>
      <dc:date>2024-05-11T05:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753551#M93533</link>
      <description>&lt;P&gt;Here is the best I could do.&amp;nbsp; It required a table change to allow for Graph Builder to have separate X axes for each product.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "Table1" );
dt &amp;lt;&amp;lt; New Column( "PM2 date",
	formula( If( :Product == "PM2", :Date, . ) ),
	Format( "m/d/y h:m:s" )
);
dt &amp;lt;&amp;lt; New Column( "PM3 date",
	formula( If( :Product == "PM4", :Date, . ) ),
	Format( "m/d/y h:m:s" )
);
dt &amp;lt;&amp;lt; New Column( "PM4 date",
	formula( If( :Product == "PM2", :Date, . ) ),
	Format( "m/d/y h:m:s" )
);
dtRefLineDef = Data Table( "Table2" );

Graph Builder(
	Size( 534, 464 ),
	Show Control Panel( 0 ),
	Variables( X( :PM2 Date ), X( :PM3 Date ), X( :PM4 Date ), Y( :Yield ) ),
	Elements(
		Position( 1, 1 ),
		Points( X, Y, Legend( 9 ) ),
		Smoother( X, Y, Legend( 10 ) )
	),
	Elements(
		Position( 2, 1 ),
		Points( X, Y, Legend( 11 ) ),
		Smoother( X, Y, Legend( 12 ) )
	),
	Elements(
		Position( 3, 1 ),
		Points( X, Y, Legend( 13 ) ),
		Smoother( X, Y, Legend( 14 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				9,
				Properties( 0, {Line Color( 0 )}, Item ID( "Yield", 1 ) )
			), Legend Model(
				10,
				Properties( 0, {Line Color( 0 )}, Item ID( "Smooth", 1 ) )
			), Legend Model(
				11,
				Properties( 0, {Line Color( 0 )}, Item ID( "Yield", 1 ) )
			), Legend Model(
				12,
				Properties( 0, {Line Color( 0 )}, Item ID( "Smooth", 1 ) )
			), Legend Model(
				13,
				Properties( 0, {Line Color( 0 )}, Item ID( "Yield", 1 ) )
			), Legend Model(
				14,
				Properties( 0, {Line Color( 0 )}, Item ID( "Smooth", 1 ) )
			)}
		),
		Dispatch( {}, "400", LegendBox,
			{Legend Position(
				{9, [-1], 10, [-1], 11, [-1], 12, [-1], 13, [-1], 14, [-1]}
			)}
		)
	)
);

gbr = Current Report();

For( i = 1, i &amp;lt;= N Rows( dtRefLineDef ), i++,
	If(
		dtRefLineDef:Product[i] == "PM2", box = 1,
		dtRefLineDef:Product[i] == "PM3", box = 3,
		dtRefLineDef:Product[i] == "PM4", box = 4
	);
	gbr[axisbox( box )] &amp;lt;&amp;lt; add ref line(
		dtRefLineDef:Design Change Dates[i], "Solid", "Black",
		dtRefLineDef:Design Name[i]
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1715409678264.png" style="width: 638px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64089i9A1E905C2BDBDCF3/image-dimensions/638x624?v=v2" width="638" height="624" role="button" title="txnelson_0-1715409678264.png" alt="txnelson_0-1715409678264.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2024 06:41:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753551#M93533</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-05-11T06:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753606#M93539</link>
      <description>&lt;P&gt;If you are using &lt;STRONG&gt;JMP18&lt;/STRONG&gt;, this is other option you could try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt1 = Open("$DOWNLOADS/table1.jmp");
dt2 = Open("$DOWNLOADS/table2.jmp");

gb = dt1 &amp;lt;&amp;lt; Graph Builder(
	Size(1162, 468),
	Show Control Panel(0),
	Link Page Axes("Y Only"),
	// Replicate Linked Page Axes(0), // would show Y-axis only once
	Variables(X(:Date), Y(:Yield), Page(:Product, Levels per Row(3), Show Title(0))),
	Elements(Points(X, Y, Legend(4)), Smoother(X, Y, Legend(5)))
);

// get PM list
Summarize(dt1, pms = By(:Product));

// Each X-Group will have its own framebox
// NOTE We assume that PM order is the default one
all_axis = Report(gb) &amp;lt;&amp;lt; XPath("//AxisBox");
abs = all_axis[1::N Items(all_axis)::2];

For Each({cur_pm, idx}, pms,
	cur_ab = abs[idx];
	// Loop over line specifications and set lines
	pm_spec_rows = dt2 &amp;lt;&amp;lt; get rows where(:Product == cur_pm);
	For Each({spec_row}, pm_spec_rows,
		val = dt2[spec_row, "Design Change Dates"];
		name = dt2[spec_row, "Design Name"];
		cur_ab &amp;lt;&amp;lt; Add Ref Line(val, "Solid", "Red", name, 1);
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It utilizes new "grid" style when using Page. This allows us to have separate X-axis for each of the groups&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1715439176753.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64114i5C0BD78C00DB9E52/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_0-1715439176753.png" alt="jthi_0-1715439176753.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can also show the Y-axis only once if you change Replicate Linked Page Axes setting&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1715439196971.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64115iA7AF9A37A748DC1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_1-1715439196971.png" alt="jthi_1-1715439196971.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2024 14:53:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753606#M93539</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-11T14:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753612#M93543</link>
      <description>&lt;P&gt;Not being a scripter, I tried something different.&amp;nbsp; In the attached I created a column for "new product" in Table 2, and then joined the tables using Product as the key.&amp;nbsp; The stored graph from Graph Builder colored the points by the Design Name, used Product in the Group X field, and selected both Date and Design Change Dates as X variables with Yield as Y.&amp;nbsp; I modified the marker size.&amp;nbsp; I think more could be done to improve the display (at least move PM3 to the right since it had no design changes).&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2024 19:15:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753612#M93543</guid>
      <dc:creator>dlehman1</dc:creator>
      <dc:date>2024-05-11T19:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753627#M93544</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;This is fantastic! I learnt a lot from this.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2024 04:46:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753627#M93544</guid>
      <dc:creator>cchueng</dc:creator>
      <dc:date>2024-05-12T04:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: One chart with Different Reference Lines for Different Products</title>
      <link>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753628#M93545</link>
      <description>&lt;P&gt;Jarmo,&lt;/P&gt;&lt;P&gt;I am using JMP17. I am request now for JMP18 from my IT department. I definitely want to try your script to produce such beautiful charts! Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2024 04:48:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/One-chart-with-Different-Reference-Lines-for-Different-Products/m-p/753628#M93545</guid>
      <dc:creator>cchueng</dc:creator>
      <dc:date>2024-05-12T04:48:46Z</dc:date>
    </item>
  </channel>
</rss>

