<?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: How to fill bars with patterns by using Fill Patterns in iteration? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/472162#M71676</link>
    <description>&lt;P&gt;I have not been able to get this script to work. Any advice ?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Harald&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 05:59:11 GMT</pubDate>
    <dc:creator>harald_ackerman</dc:creator>
    <dc:date>2022-03-23T05:59:11Z</dc:date>
    <item>
      <title>How to fill bars with patterns by using Fill Patterns in iteration?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/272082#M52925</link>
      <description>&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;I would like to fill some bars for specified variables automatically with predefined fill patterns. The number of variables, however, is changing and I would like to do that in iteration depending what variables are currently saved in a datatable. In this case I need to provide argument to Fill Pattern() either as an index (which didn't seem to work) or some reference from a list but for that I would need a list of fill patterns. Then I could use index of item in a list. I would appreciate for help how to do that.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
	Size( 734, 660 ),
	Variables( //that would be good to have it in iteration
		X( :Run ),
		Y( :Param0 ),
		Y( :Param1, Position( 2 ) ),
		Y( :Param2, Position( 2 ) ),
		Y( :Param3, Position( 2 ) ),
		// there is much more of such variables to be displayed
	),
	
	Elements( Position( 1, 1 ), Points( X, Y, Legend( 455 ) ) ),
	
	Elements( //that would be good to have it in iteration
		Position( 1, 2 ),
		Bar(
			X,
			Y( 3 ),
			Y( 5 ),
			Y( 6 ),
			Y( 7 ),
			Legend( 454 ),
			Bar Style( "Stacked" )
		)
	),	
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				455,
				Properties( 0, {Line Color( 25 )}, Item ID( "Param0", 1 ) )
			), Legend Model(
				454,
				
				//that would be good to have it in iteration
				Properties(
					0,
					{Fill Pattern( "left slant light" )},
					Item ID( "Mittelwert(Param1)", 1 )
				),
				Properties(
					2,
					{Fill Pattern( "right slant light" )},
					Item ID( "Mittelwert(Param2)", 1 )
				),
				Properties(
					3,
					{Fill Pattern( "grid heavy" )},
					Item ID( "Mittelwert(Param3)", 1 )
				),
				// there is much more of such properties
				
			)}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position(
				{455, [0], 454, [10, -1, 1, 11]}
			), Position(
				{0, 10, -1, 1, 11}
			)}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;I started to solve the above issue by using expressions to which data can be passed.&lt;/P&gt;&lt;P&gt;I wanted to set properties of a legend of a bar chart in "for-loop" and insert into legend_model_expr defined before the for-loop. Then I would substitute that expression in an appropriate place in Graph Builder. In this case two problems occurred. Firstly, if both "insert into" commends are commented, an error occurs:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Name not resolved: Properties when accessing or evaluating properties. &lt;/STRONG&gt;Am I using that correctly? Secondly if I uncomment both "insert into" (or even one of them), another error is displayed: &lt;STRONG&gt;Too many arguments when accessing or evaluating For.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I would appreciate for hints what am I missing. Best regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//pattern list
fill_patterns_shuffled = {"left slant light", "horizontal light", "right slant light", "vertical light"};
//list of parameters, it can change depending on data available
list2 = {"Param1", "Param2", "Param3"};

legend_model_expr = Expr( Legend Model (53) );
For( c = 1, c &amp;lt;= N Items( list2 ), c++,
	
	y_expr3 = Eval(Parse( "Properties( " || char(c-1) || ", {Fill Pattern( \!"" || fill_patterns_shuffled[ c ] || "\!") }, Item ID( \!"Mittelwert(" || char(list2[ c ]) || ")\!", 1 ) ),"		
						),
					),
		
	//write(y_expr3);
	//Insert Into( y_expr3, 1 );
	//Insert Into( legend_model_expr, Name Expr( y_expr3) );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;Ok, by using Eval JMP looks for "Properties" function, which actually does not exist, so probably that is why an error occurs. The second error however is remaining.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:28:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/272082#M52925</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2023-06-09T23:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill bars with patterns by using Fill Patterns in iteration?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/274409#M53227</link>
      <description>&lt;P&gt;Ok, I got it working. Below I pasted a correct code. Best regards&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//legend
legend_model_expr = Expr( Legend Model (26) );
For( c = 1, c &amp;lt;= N Items( list2 ), c++,	
	y_expr3 = substitute(expr( Properties( c1, {Fill Pattern( fill ) }, Item ID( "Mittelwert(" || name || ")" , 1 ), ), ), expr(c1), c, expr(fill), char(fill_patterns_shuffled[c]), expr(name), list2[c]);	
	//show(y_expr3);
	Insert Into( y_expr3, "");
	Insert Into( legend_model_expr, Name Expr( y_expr3) );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jun 2020 11:41:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/274409#M53227</guid>
      <dc:creator>lukasz</dc:creator>
      <dc:date>2020-06-19T11:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill bars with patterns by using Fill Patterns in iteration?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/472162#M71676</link>
      <description>&lt;P&gt;I have not been able to get this script to work. Any advice ?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Harald&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 05:59:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fill-bars-with-patterns-by-using-Fill-Patterns-in/m-p/472162#M71676</guid>
      <dc:creator>harald_ackerman</dc:creator>
      <dc:date>2022-03-23T05:59:11Z</dc:date>
    </item>
  </channel>
</rss>

