<?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 Plotting conditionally in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/367827#M61771</link>
    <description>&lt;P&gt;Hi JMP Community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following piece of code as part of an add-in I made:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Report7 = Platform(
				dt,
				gb7 = Graph Builder(
				        Size( 632, 571 ),
					Show Control Panel( 0 ),
					Fit to Window( "Maintain Aspect Ratio" ),
					Variables( X( :Order No. ),
						Y( :S0a value, Position( 1 ) ),
						Y( :S1a value, Position( 1 ) ),
						Y( :S1b value, Position( 1 ) ),
						Y( :S1c value, Position( 1 ) ),
						Y( :S2a value, Position( 1 ) ),
						Y( :S3a value, Position( 1 ) ),
						Y( :S4b value, Position( 1 ) ) ),
					Elements(
						Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Y( 5 ),
							Y( 6 ), Y( 7 ), Legend( 11 ) )
						),
				)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The issue is that I don't always have all the columns that I'm asking the add-in to plot on the y-axis (e.g. the data table might only have S0a - S1c rather than S0a - S4b). When this is the case, the resulting plot is just a histogram of the x-axis column (i.e. of "Order No.").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way of making the code plot whatever columns are available and automatically ignore the ones that aren't? I'm open to other ideas as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ahmed&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:11:59 GMT</pubDate>
    <dc:creator>A_Zaid</dc:creator>
    <dc:date>2023-06-11T11:11:59Z</dc:date>
    <item>
      <title>Plotting conditionally</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/367827#M61771</link>
      <description>&lt;P&gt;Hi JMP Community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following piece of code as part of an add-in I made:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Report7 = Platform(
				dt,
				gb7 = Graph Builder(
				        Size( 632, 571 ),
					Show Control Panel( 0 ),
					Fit to Window( "Maintain Aspect Ratio" ),
					Variables( X( :Order No. ),
						Y( :S0a value, Position( 1 ) ),
						Y( :S1a value, Position( 1 ) ),
						Y( :S1b value, Position( 1 ) ),
						Y( :S1c value, Position( 1 ) ),
						Y( :S2a value, Position( 1 ) ),
						Y( :S3a value, Position( 1 ) ),
						Y( :S4b value, Position( 1 ) ) ),
					Elements(
						Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Y( 5 ),
							Y( 6 ), Y( 7 ), Legend( 11 ) )
						),
				)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The issue is that I don't always have all the columns that I'm asking the add-in to plot on the y-axis (e.g. the data table might only have S0a - S1c rather than S0a - S4b). When this is the case, the resulting plot is just a histogram of the x-axis column (i.e. of "Order No.").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way of making the code plot whatever columns are available and automatically ignore the ones that aren't? I'm open to other ideas as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:11:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/367827#M61771</guid>
      <dc:creator>A_Zaid</dc:creator>
      <dc:date>2023-06-11T11:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting conditionally</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/368131#M61797</link>
      <description>&lt;P&gt;This might be on option, you would need to populate the variables cols with the actual list you want to include:&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/probe.jmp");

//Variables to hold the dynamic parts of the graph builder expresssion
Expr1 = "";
Expr2 = "";

// Pick columns to include
cols = ( dt &amp;lt;&amp;lt; get column names() )[random shuffle(8::397)[1::5]];

//Populate expressions
for(c=1, c&amp;lt;= n items(cols), c++,
	Expr1 = Expr1 || "Y( Column( \!"" || cols[c] || "\!" ), Position(1) ),";
	Expr2 = Expr2 || "Y( " || char( c ) || " ),";
);

Eval( Parse( substitute(
	//the graph builder script as a string with 'dummy variables' where the
	//expressions created earlier will go
	"gb = Graph Builder(
		Size( 838, 391 ),
		Variables(
			X( :DELL_RPPBR ),
			Expr1_
		),
		Elements( Line( X, Expr2_ Legend( 10 ) ) ),
		Local Data Filter(
			Add Filter(
				columns( :DELL_RPPBR ),
				Where( :DELL_RPPBR &amp;gt;= -1 &amp;amp; :DELL_RPPBR &amp;lt;= 0.483837991952896 )
			)
		)
	)",
	//replace the 'dummy variables'
	"Expr1_",
	Expr1,
	"Expr2_",
	Expr2
) ) );
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Mar 2021 02:52:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/368131#M61797</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-03-16T02:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting conditionally</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/368227#M61814</link>
      <description>This did the job! Thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6657"&gt;@ih&lt;/a&gt;!</description>
      <pubDate>Tue, 16 Mar 2021 13:43:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-conditionally/m-p/368227#M61814</guid>
      <dc:creator>A_Zaid</dc:creator>
      <dc:date>2021-03-16T13:43:54Z</dc:date>
    </item>
  </channel>
</rss>

