<?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: Check Box to toggle jitter on/off on Graph Builder in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481894#M72631</link>
    <description>&lt;P&gt;Manipulating Elements is a mess to my knowledge and it gets even messier when you have grouping. That's why I try to (usually) avoid it and just redo the graph. Here is one way you could try using Update Elements to change Jitter&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

jitter = 1;
New Window("",
	V List Box(
		H List Box(
			cb = Check Box(
				{"Jitter enabled"},
				If(cb &amp;lt;&amp;lt; Get() == 1,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("Positive Grid"), Jitter Limit(jitter)});
				,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("None")});
				)
			),
			sb = Slider Box(0, 2, jitter, neb &amp;lt;&amp;lt; set(jitter)), 
			   
			neb = Number Edit Box(
				jitter,
				&amp;lt;&amp;lt;setfunction(
					Function({this},
						jitter = this &amp;lt;&amp;lt; get;
						sb &amp;lt;&amp;lt; inval;
					)
				)
			)
		),
		gb = dt &amp;lt;&amp;lt; Graph Builder(Show Control Panel(1), Variables(X(:height), Y(:weight)), Elements(Points(X, Y)));	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other useful functions might be Add Elements and Remove Elements, also see this post &lt;LI-MESSAGE title="Updating the Graph Builder's Element statement" uid="66064" url="https://community.jmp.com/t5/Discussions/Updating-the-Graph-Builder-s-Element-statement/m-p/66064#U66064" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2022 15:34:27 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-04-25T15:34:27Z</dc:date>
    <item>
      <title>Check Box to toggle jitter on/off on Graph Builder</title>
      <link>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481870#M72627</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to have a check box object on top of Graph builder view to toggle on/off separation of overlapping points (jitter). I know that this can be done from control panel but from visualization perspective, I want to keep the control panel closed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example script below which creates control elements for&amp;nbsp;jitter on top of graph. Despite of my best efforts, I can't get the check box to toggle the jitter; I don't know what is the correct way to send update to report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am requesting Your help with the syntax.&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);
dt= Open("$SAMPLE_DATA/Big Class.jmp");

gb=Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements(
		Points( X, Y )
	)
);

jitter = 1;
jitter_elements=H List Box(
		cb=Check Box(
			{"Jitter enabled"},
			If(cb&amp;lt;&amp;lt;Get()==1,
&lt;FONT color="#FF0000"&gt;				gb &amp;lt;&amp;lt; SendToReport(Elements(Points(Jitter( "Positive Grid" ), Jitter Limit( jitter )))), // This is not correct but something like this (maybe)
				gb &amp;lt;&amp;lt; SendToReport(Elements(Points(Jitter( "None" ))))									 // This is not correct but something like this (maybe)&lt;/FONT&gt;
			);		
		),
		
		sb = Slider Box( 0, 2, jitter, 
			neb &amp;lt;&amp;lt; set( jitter );
		), 
	   
		neb = Number Edit Box(jitter, 
			&amp;lt;&amp;lt;setfunction(
				Function( {this}, 
					jitter = this &amp;lt;&amp;lt; get; 
					sb &amp;lt;&amp;lt; inval;
				)
			)
		)			
);

rgb = Report(gb);
(( rgb[PictureBox(1)] &amp;lt;&amp;lt; Parent ) &amp;lt;&amp;lt; Child ) &amp;lt;&amp;lt; Sib Append (jitter_elements);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:57:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481870#M72627</guid>
      <dc:creator>JanneI</dc:creator>
      <dc:date>2023-06-09T16:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Check Box to toggle jitter on/off on Graph Builder</title>
      <link>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481893#M72630</link>
      <description>&lt;P&gt;Nice idea, not obvious how to do it, looking forward to an answer.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 15:26:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481893#M72630</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-04-25T15:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Check Box to toggle jitter on/off on Graph Builder</title>
      <link>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481894#M72631</link>
      <description>&lt;P&gt;Manipulating Elements is a mess to my knowledge and it gets even messier when you have grouping. That's why I try to (usually) avoid it and just redo the graph. Here is one way you could try using Update Elements to change Jitter&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

jitter = 1;
New Window("",
	V List Box(
		H List Box(
			cb = Check Box(
				{"Jitter enabled"},
				If(cb &amp;lt;&amp;lt; Get() == 1,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("Positive Grid"), Jitter Limit(jitter)});
				,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("None")});
				)
			),
			sb = Slider Box(0, 2, jitter, neb &amp;lt;&amp;lt; set(jitter)), 
			   
			neb = Number Edit Box(
				jitter,
				&amp;lt;&amp;lt;setfunction(
					Function({this},
						jitter = this &amp;lt;&amp;lt; get;
						sb &amp;lt;&amp;lt; inval;
					)
				)
			)
		),
		gb = dt &amp;lt;&amp;lt; Graph Builder(Show Control Panel(1), Variables(X(:height), Y(:weight)), Elements(Points(X, Y)));	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other useful functions might be Add Elements and Remove Elements, also see this post &lt;LI-MESSAGE title="Updating the Graph Builder's Element statement" uid="66064" url="https://community.jmp.com/t5/Discussions/Updating-the-Graph-Builder-s-Element-statement/m-p/66064#U66064" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 15:34:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/481894#M72631</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-25T15:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check Box to toggle jitter on/off on Graph Builder</title>
      <link>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/482052#M72642</link>
      <description>&lt;P&gt;Thanks Jarmo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution (Update elements) works well, very good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is further modified version to get also the slider and number boxes updating the graph.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

jitter = 0.2;
New Window("",
	V List Box(
		H List Box(
			cb = Check Box(
				{"Jitter enabled"},
				If(cb &amp;lt;&amp;lt; Get() == 1,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("Positive Grid"), Jitter Limit(jitter)});
				,
					Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("None")});
				)
			),
			sb = Slider Box(0.1, 0.2, jitter,
					neb &amp;lt;&amp;lt; set(jitter);
					If(cb &amp;lt;&amp;lt; Get() == 1,
						Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("Positive Grid"), Jitter Limit(jitter)});
					);
				), 
			   
			neb = Number Edit Box(
				jitter,
				&amp;lt;&amp;lt;setfunction(
					Function({this},
						jitter = this &amp;lt;&amp;lt; get;
						if(jitter&amp;lt;0.1, jitter=0.1,  jitter&amp;gt;0.2, jitter=0.2);						
						sb &amp;lt;&amp;lt; inval;
						If(cb &amp;lt;&amp;lt; Get() == 1,
							Report(gb)[GraphBuilderBox(1)] &amp;lt;&amp;lt; Update Element(1, 1, 1, {Type("Points"), X, Y, Legend(3), Jitter("Positive Grid"), Jitter Limit(jitter)});
						);
						neb &amp;lt;&amp;lt; set(jitter);
					)
				)
			)
		),
		gb = dt &amp;lt;&amp;lt; Graph Builder(Show Control Panel(0), Variables(X(:height), Y(:weight)), Elements(Points(X, Y)));	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 06:02:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-Box-to-toggle-jitter-on-off-on-Graph-Builder/m-p/482052#M72642</guid>
      <dc:creator>JanneI</dc:creator>
      <dc:date>2022-04-26T06:02:26Z</dc:date>
    </item>
  </channel>
</rss>

