<?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: Interactive journals in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/784212#M96873</link>
    <description>&lt;P&gt;Did parts of this script work at some point?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2024 18:57:13 GMT</pubDate>
    <dc:creator>Byron_JMP</dc:creator>
    <dc:date>2024-08-26T18:57:13Z</dc:date>
    <item>
      <title>Interactive journals</title>
      <link>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/783937#M96861</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am working with JMP and need assistance with creating an interactive journal. My goal is to include a feature that allows users to select and highlight specific batches within a graph. Here are the details of the script and what I am trying to achieve:&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;Names Default To Here(1);

Current Data Table(dt);
dt &amp;lt;&amp;lt; New Column("Time Point Months", Formula(Round(:Time Point Days / 30.438), 2));

// Loop for each parameter
For(i = 1, i &amp;lt;= N Items(numPar), i++,
	col1 = Col Box("");
	col2 = Col Box("");
	col3 = Col Box("");

// Create all batches plot
	gb = Graph Builder(
		invisible,
		Size(500, 500),
		Variables(X(:Time Point Months), Y(:Result), Overlay(:Batch)),
		Elements(Points(X, Y))
	);
	gb &amp;lt;&amp;lt; Local Data Filter(
		Add Filter(
			columns(:Component, :Batch, :Source Table),
			Where(:Component == numPar[i]),
			Where(:Batch == {cyc, bat}),
			Where(:Source Table == dt_name)
		)
	);
	dt &amp;lt;&amp;lt; Clear Select();

	gbb = Report(gb)[GraphBuilderBox(1)];
	gbb &amp;lt;&amp;lt; Add Element(1, 1, {Type("Line Of Fit"), X, Y, Confidence of Fit(0), Equation(0)});

// Set Y axis
	minval = Min(
		:Result[dt &amp;lt;&amp;lt; get rows where(
			:Component == numPar[i] &amp;amp; :Batch == cyc &amp;amp; :Source Table == dt_name | :Batch == bat
			 &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
		)]
	) * 0.95;
	maxval = Max(
		:Result[dt &amp;lt;&amp;lt; get rows where(
			:Component == numPar[i] &amp;amp; :Batch == cyc &amp;amp; :Source Table == dt_name | :Batch == bat
			 &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
		)]
	) * 1.05;
	maxvalts = Max(
		:Time Point Months[dt &amp;lt;&amp;lt; get rows where(
			:Component == numPar[i] &amp;amp; :Batch == cyc &amp;amp; :Source Table == dt_name | :Batch == bat
			 &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
		)]
	) * 1.05;

	gbb[AxisBox(1)] &amp;lt;&amp;lt; Min(-0.1);
	gbb[AxisBox(1)] &amp;lt;&amp;lt; Max(maxvalts);
	gbb[AxisBox(2)] &amp;lt;&amp;lt; Min(minval);
	gbb[AxisBox(2)] &amp;lt;&amp;lt; Max(maxval);
	gbb[AxisBox(2)] &amp;lt;&amp;lt; inc((maxval - minval) / 10);

// Set Y axis label
	unitList = Associative Array(
		:Result Unit[dt &amp;lt;&amp;lt; get rows where(
			:Component == numPar[i] &amp;amp; :Batch == cyc &amp;amp; :Source Table == dt_name | :Batch == bat
			 &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
		)]
	) &amp;lt;&amp;lt; Remove("") &amp;lt;&amp;lt; Get Keys;
	If(N Items(unitList) == 1,
		gbb[Text Edit Box(4)] &amp;lt;&amp;lt; Set text(numPar[i] || " [" || unitList[1] || "]")
	);
	If(N Items(unitList) != 1,
		gbb[Text Edit Box(4)] &amp;lt;&amp;lt; Set text(numPar[i])
	);

// Set graph title
	gbb[Text Edit Box(1)] &amp;lt;&amp;lt; Set text(numPar[i] || " vs. Time Point ");
	gbba = Report(gb);
	col1 &amp;lt;&amp;lt; Append(gbba);
	gb &amp;lt;&amp;lt; close window;

	For(k = 1, k &amp;lt;= N Items(cyc), k++,
		check = dt &amp;lt;&amp;lt; get rows where(
			:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt_name | :Batch ==
			bat[k] &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
		);
		If(N Items(check) &amp;gt; 0,
			gb = Graph Builder(
				invisible,
				Size(500, 500),
				Variables(X(:Time Point Months), Y(:Result), Overlay(:Batch)),
				Elements(Points(X, Y))
			);
			gb &amp;lt;&amp;lt; Local Data Filter(
				Add Filter(
					columns(:Component, :Batch, :Source Table),
					Where(:Component == numPar[i]),
					Where(:Batch == {cyc[k], bat[k]}),
					Where(:Source Table == dt_name)
				)
			);
			dt &amp;lt;&amp;lt; Clear Select();

			gbb = Report(gb)[GraphBuilderBox(1)];
			gbb &amp;lt;&amp;lt; Add Element(
				1,
				1,
				{Type("Line Of Fit"), X, Y, Confidence of Fit(0), Equation(0)}
			);

			minval = Min(
				:Result[dt &amp;lt;&amp;lt; get rows where(
					:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt_name |
					:Batch == bat[k] &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
				)]
			) * 0.95;
			maxval = Max(
				:Result[dt &amp;lt;&amp;lt; get rows where(
					:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt_name |
					:Batch == bat[k] &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
				)]
			) * 1.05;
			maxvalts = Max(
				:Time Point Months[dt &amp;lt;&amp;lt; get rows where(
					:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt_name |
					:Batch == bat[k] &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
				)]
			) * 1.05;

			gbb[AxisBox(1)] &amp;lt;&amp;lt; Min(-0.1);
			gbb[AxisBox(1)] &amp;lt;&amp;lt; Max(maxvalts);
			gbb[AxisBox(2)] &amp;lt;&amp;lt; Min(minval);
			gbb[AxisBox(2)] &amp;lt;&amp;lt; Max(maxval);
			gbb[AxisBox(2)] &amp;lt;&amp;lt; inc((maxval - minval) / 10);

			unitList = Associative Array(
				:Result Unit[dt &amp;lt;&amp;lt; get rows where(
					:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt_name |
					:Batch == bat[k] &amp;amp; :Component == numPar[i] &amp;amp; :Source Table == dt_name
				)]
			) &amp;lt;&amp;lt; Remove("") &amp;lt;&amp;lt; Get Keys;
			If(N Items(unitList) == 1,
				gbb[Text Edit Box(4)] &amp;lt;&amp;lt; Set text(numPar[i] || " [" || unitList[1] || "]")
			);
			If(N Items(unitList) != 1,
				gbb[Text Edit Box(4)] &amp;lt;&amp;lt; Set text(numPar[i])
			);

			gbb[Text Edit Box(1)] &amp;lt;&amp;lt; Set text(numPar[i] || " vs. Time Point ");
			gbba = Report(gb);
			col2 &amp;lt;&amp;lt; Append(gbba);
			gb &amp;lt;&amp;lt; close window;

			gb2 = Graph Builder(
				invisible,
				Size(500, 500),
				Variables(X(:Time Point Months), Y(:Difference), Color(:Batch)),
				Elements(Points(X, Y))
			);
			gb2 &amp;lt;&amp;lt; Local Data Filter(
				Add Filter(
					columns(:Component, :Batch, :Source Table),
					Where(:Component == numPar[i]),
					Where(:Batch == cyc[k]),
					Where(:Source Table == dt5_name)
				)
			);
			dt4 &amp;lt;&amp;lt; Clear Select();

			gbb2 = Report(gb2)[GraphBuilderBox(1)];
			gbb2 &amp;lt;&amp;lt; Add Element(1, 1, {Type("Line"), X, Y});

			l_idx = dt4 &amp;lt;&amp;lt; Get rows where(dt4:Component == numPar[i] &amp;amp; :Batch == cyc[k]);
			ul = Min(dt4:HC[l_idx]);

			If(Is Missing(ul),
				If(
					Min(
						:Difference[dt &amp;lt;&amp;lt; get rows where(
							:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table ==
							dt5_name
						)]
					) == 0,
					minval = -5;
					maxval = 5;
				,
					minval = Min(
						:Difference[dt &amp;lt;&amp;lt; get rows where(
							:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table ==
							dt5_name
						)]
					) * 0.95;
					maxval = Max(
						:Difference[dt &amp;lt;&amp;lt; get rows where(
							:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table ==
							dt5_name
						)]
					) * 1.05;
				)
			,
				minval = Min(
					:Difference[dt &amp;lt;&amp;lt; get rows where(
						:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt5_name
					)],
					-ul
				) * 1.05;
				maxval = Max(
					:Difference[dt &amp;lt;&amp;lt; get rows where(
						:Component == numPar[i] &amp;amp; :Batch == cyc[k] &amp;amp; :Source Table == dt5_name
					)],
					ul
				) * 1.05;
			);

			If(!Is Missing(ul),
				gbb2[AxisBox(2)] &amp;lt;&amp;lt; Add Ref Line(ul, "solid", "black", Char(Round(ul, 2)));
				gbb2[AxisBox(2)] &amp;lt;&amp;lt; Add Ref Line(-ul, "solid", "black", Char(Round(-ul, 2)));
			);

			gbb2[AxisBox(2)] &amp;lt;&amp;lt; Add Ref Line(0, "Dashed");
			gbb2[AxisBox(2)] &amp;lt;&amp;lt; Min(minval);
			gbb2[AxisBox(2)] &amp;lt;&amp;lt; Max(maxval);
			gbb2[AxisBox(2)] &amp;lt;&amp;lt; inc((maxval - minval) / 10);

			gbba2 = Report(gb2);
			col3 &amp;lt;&amp;lt; Append(gbba2);
			gb2 &amp;lt;&amp;lt; close window;
		);
	);

	results &amp;lt;&amp;lt; append(ob = Outline Box(numPar[i], V List Box(col1, H List Box(col2, col3))));
	ob &amp;lt;&amp;lt; close;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit (jthi 2024-08-26): Added JSL formatting&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Interactive Dropdown Menu&lt;/STRONG&gt;: I want to create a dropdown menu that lists the unique batch values (&lt;CODE&gt;:Batch&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;column) in my data table.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Highlighting Functionality&lt;/STRONG&gt;: When a user selects a batch from the dropdown menu, the corresponding points in the graph should be highlighted.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Embedding in a Journal&lt;/STRONG&gt;: The dropdown menu and the graph should be embedded in a journal that can be saved and shared.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 26 Aug 2024 12:06:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/783937#M96861</guid>
      <dc:creator>ConvergentWhale</dc:creator>
      <dc:date>2024-08-26T12:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Interactive journals</title>
      <link>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/784212#M96873</link>
      <description>&lt;P&gt;Did parts of this script work at some point?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 18:57:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/784212#M96873</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2024-08-26T18:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Interactive journals</title>
      <link>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/785206#M96886</link>
      <description>&lt;P&gt;Yes the script works :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 08:07:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Interactive-journals/m-p/785206#M96886</guid>
      <dc:creator>ConvergentWhale</dc:creator>
      <dc:date>2024-08-27T08:07:31Z</dc:date>
    </item>
  </channel>
</rss>

