<?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 Creating multiple varcharts for a given list of columns with different legends for each var chart using a newly created legend column everytime. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666744#M85477</link>
    <description>&lt;P&gt;I want to create journal of varcharts for a list of columns in a dataset with different legends. a legend column is mentioned which would change in reality for each loop. everything works expect the new column formula does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, i have used a static legend value of "ABC" but this would change for every loop in reality. the issue is the new formula column does not evaluate the column name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

mycolumnList = {"species","subject","season"};


For( i = 1, i &amp;lt;= N Items(mycolumnList), i++, 
	Try(dt &amp;lt;&amp;lt; delete column("LegendCol"));

	legend = "ABC";

	Try( dt &amp;lt;&amp;lt; New Column( "LegendCol", Formula( If(Column(mycolumnList[i])[Row()] == legend, "first", "rest" ) ) ) );


	myvarChart = vlb &amp;lt;&amp;lt; append(
	dt &amp;lt;&amp;lt; Variability Chart(
		Y( :miles ),
		X( eval(mycolumnList[i]) ),
		Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
		Connect Cell Means( 1 ),
		Variability Summary Report( 1 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		Show Box Plots( 1 ),
		Name( "Show Gauge R&amp;amp;R Specifications Dialog" )(0),
		Automatic Recalc( 1 ),
		SendToReport(
			Dispatch(
				{"Variability ChartD"},
				"Variability Chart",
				FrameBox,
				{Row Legend(
					Name( "LegendCol" ),
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 1 ),
					Marker Theme( "Solid" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			)
		)
	));	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2023 17:57:55 GMT</pubDate>
    <dc:creator>ankitgssingh</dc:creator>
    <dc:date>2023-08-08T17:57:55Z</dc:date>
    <item>
      <title>Creating multiple varcharts for a given list of columns with different legends for each var chart using a newly created legend column everytime.</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666744#M85477</link>
      <description>&lt;P&gt;I want to create journal of varcharts for a list of columns in a dataset with different legends. a legend column is mentioned which would change in reality for each loop. everything works expect the new column formula does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, i have used a static legend value of "ABC" but this would change for every loop in reality. the issue is the new formula column does not evaluate the column name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

mycolumnList = {"species","subject","season"};


For( i = 1, i &amp;lt;= N Items(mycolumnList), i++, 
	Try(dt &amp;lt;&amp;lt; delete column("LegendCol"));

	legend = "ABC";

	Try( dt &amp;lt;&amp;lt; New Column( "LegendCol", Formula( If(Column(mycolumnList[i])[Row()] == legend, "first", "rest" ) ) ) );


	myvarChart = vlb &amp;lt;&amp;lt; append(
	dt &amp;lt;&amp;lt; Variability Chart(
		Y( :miles ),
		X( eval(mycolumnList[i]) ),
		Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
		Connect Cell Means( 1 ),
		Variability Summary Report( 1 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		Show Box Plots( 1 ),
		Name( "Show Gauge R&amp;amp;R Specifications Dialog" )(0),
		Automatic Recalc( 1 ),
		SendToReport(
			Dispatch(
				{"Variability ChartD"},
				"Variability Chart",
				FrameBox,
				{Row Legend(
					Name( "LegendCol" ),
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 1 ),
					Marker Theme( "Solid" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			)
		)
	));	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 17:57:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666744#M85477</guid>
      <dc:creator>ankitgssingh</dc:creator>
      <dc:date>2023-08-08T17:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple varcharts for a given list of columns with different legends for each var chart using a newly created legend column everytime.</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666780#M85479</link>
      <description>&lt;P&gt;I have reworked you script a bit.&amp;nbsp; I am not sure it gets you the total solution.&amp;nbsp; However, it seems to work on your sample data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// I want to create journal of varcharts for a list of columns in a dataset 
// with different legends. a legend column is mentioned which would change in 
// reality for each loop. everything works expect the new column formula does not work.  
//In this example, i have used a static legend value of "ABC" but this would change 
// for every loop in reality. the issue is the new formula column does not evaluate 
// the column name dt = current data table();

nw = New Window( "test", vlb = V List Box() );

dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};


For( i = 1, i &amp;lt;= N Items( mycolumnList ), i++,
	Try( dt &amp;lt;&amp;lt; delete column( "LegendCol" ) );
	
	legend = "ABC";
	
	Eval(
		Substitute(
				Expr(
					Try(
						dt &amp;lt;&amp;lt; New Column( "LegendCol", Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) ) )
					)
				),
			Expr( _mycolumnList_ ), mycolumnlist[i],
			Expr( _legend_ ), legend
		)
	);

	myvarChart = vlb &amp;lt;&amp;lt; append(
		dt &amp;lt;&amp;lt; Variability Chart(
			Y( :miles ),
			X( Eval( mycolumnList[i] ) ),
			Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
			Connect Cell Means( 1 ),
			Variability Summary Report( 1 ),
			Std Dev Chart( 0 ),
			Points Jittered( 1 ),
			Show Box Plots( 1 ),
			Name( "Show Gauge R&amp;amp;R Specifications Dialog" )(0),
			Automatic Recalc( 1 ),
			SendToReport(
				Dispatch(
					{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
					"Variability Chart",
					FrameBox,
					{Row Legend(
						LegendCol,
						Color( 1 ),
						Color Theme( "JMP Default"(1) ),
						Marker( 0 ),
						Marker Theme( "" ),
						Continuous Scale( 0 ),
						Reverse Scale( 0 ),
						Excluded Rows( 0 )
					)}
				)
			)
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Aug 2023 18:29:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666780#M85479</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-08-08T18:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple varcharts for a given list of columns with different legends for each var chart using a newly created legend column everytime.</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666990#M85498</link>
      <description>&lt;P&gt;Thanks Jim, but this is still having one small issue. Somehow all plots are getting the same legend.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, something like this. the legend changes everytime in the loop. however, the legends are not being picked up in the var charts. i always get the final legend column legends in all plots&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nw = New Window( "test", vlb = V List Box() );

dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};
mylegendList = Associative Array({"species","subject","season"},{"FOX","2","summer"});

For( i = 1, i &amp;lt;= N Items( mycolumnList ), i++,
	Try( dt &amp;lt;&amp;lt; delete column( "LegendCol" ) );
	
	//legend = "ABC";
	legend = mylegendList[mycolumnList[i]];
	
	Eval(
		Substitute(
				Expr(
					Try(
						dt &amp;lt;&amp;lt; New Column( "LegendCol", Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) ) )
					)
				),
			Expr( _mycolumnList_ ), mycolumnlist[i],
			Expr( _legend_ ), legend
		)
	);

	myvarChart = vlb &amp;lt;&amp;lt; append(
		dt &amp;lt;&amp;lt; Variability Chart(
			Y( :miles ),
			X( Eval( mycolumnList[i] ) ),
			Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
			Connect Cell Means( 1 ),
			Variability Summary Report( 1 ),
			Std Dev Chart( 0 ),
			Points Jittered( 1 ),
			Show Box Plots( 1 ),
			Name( "Show Gauge R&amp;amp;R Specifications Dialog" )(0),
			Automatic Recalc( 1 ),
			SendToReport(
				Dispatch(
					{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
					"Variability Chart",
					FrameBox,
					{Row Legend(
						LegendCol,
						Color( 1 ),
						Color Theme( "JMP Default"(1) ),
						Marker( 0 ),
						Marker Theme( "" ),
						Continuous Scale( 0 ),
						Reverse Scale( 0 ),
						Excluded Rows( 0 )
					)}
				)
			))));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 08:31:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/666990#M85498</guid>
      <dc:creator>ankitgssingh</dc:creator>
      <dc:date>2023-08-09T08:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple varcharts for a given list of columns with different legends for each var chart using a newly created legend column everytime.</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/667037#M85503</link>
      <description>&lt;P&gt;To do what you are doing I believe you are going to have to create a separate Legends column for each chart&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
nw = New Window( "test", vlb = V List Box() );

dt = Current Data Table();
mycolumnList = {"species", "subject", "season"};
mylegendList = Associative Array( {"species", "subject", "season"}, {"FOX", "2", "summer"} );

For( i = 1, i &amp;lt;= N Items( mycolumnList ), i++,
	Try( dt &amp;lt;&amp;lt; delete column( "LegendCol" || Char( i ) ) );
	
	//legend = "ABC";
	legend = mylegendList[mycolumnList[i]];
	
	Eval(
		Substitute(
				Expr(
					Try(
						dt &amp;lt;&amp;lt; New Column( "LegendCol" || Char( i ),
							Formula( If( Char( As Column( _mycolumnList_ ) ) == _legend_, "first", "rest" ) )
						)
					)
				),
			Expr( _mycolumnList_ ), mycolumnlist[i],
			Expr( _legend_ ), legend
		)
	);
	Eval(
		Substitute(
				Expr(
					myvarChart = vlb &amp;lt;&amp;lt; append(
						dt &amp;lt;&amp;lt; Variability Chart(
							Y( :miles ),
							X( Eval( mycolumnList[i] ) ),
							Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
							Connect Cell Means( 1 ),
							Variability Summary Report( 1 ),
							Std Dev Chart( 0 ),
							Points Jittered( 1 ),
							Show Box Plots( 1 ),
							Name( "Show Gauge R&amp;amp;R Specifications Dialog" )(0),
							Automatic Recalc( 1 ),
							SendToReport(
								Dispatch(
									{"Variability Gauge Analysis for miles", "Variability Chart for miles"},
									"Variability Chart",
									FrameBox,
									{Row Legend(
										_LegendCol_,
										Color( 1 ),
										Color Theme( "JMP Default"(1) ),
										Marker( 0 ),
										Marker Theme( "" ),
										Continuous Scale( 0 ),
										Reverse Scale( 0 ),
										Excluded Rows( 0 )
									)}
								)
							)
						)
					)
				),
			Expr( _legendcol_ ), Parse( "LegendCol" || Char( i ) )
		)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2023 21:06:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-multiple-varcharts-for-a-given-list-of-columns-with/m-p/667037#M85503</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-08-09T21:06:03Z</dc:date>
    </item>
  </channel>
</rss>

