<?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 use JSL to set the color gradient of a column in text format by the value of a numeric column? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688254#M87397</link>
    <description>&lt;P&gt;Thank Jim!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
m= 4 ;Column(m)&amp;lt;&amp;lt;set property("Color Gradient",{"Green to White to Red",Range({col min(Column(m)),col max(Column(m)),col mean(Column(m))})})&amp;lt;&amp;lt;Color Cell by Value;

//？？
theScript = Char( :height &amp;lt;&amp;lt; get script );
theScript = Substr( theScript, Contains( theScript, "Color Cells" ) );
theScript = ":Name&amp;lt;&amp;lt;" || Substr(
	theScript,
	1,
	Contains( theScript, "Set Value" ) - 3
);
Eval( Parse( theScript ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Oct 2023 05:15:26 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2023-10-18T05:15:26Z</dc:date>
    <item>
      <title>How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688226#M87393</link>
      <description>&lt;P&gt;For example, the name column of Big Class.jmp automatically sets the color gradient of the name based on the value of the height column&lt;BR /&gt;It is required to be done in script.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-18_9-58-29.png" style="width: 529px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57747i862C68C33DAD5369/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-18_9-58-29.png" alt="2023-10-18_9-58-29.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 02:05:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688226#M87393</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T02:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688237#M87395</link>
      <description>&lt;P&gt;Here is the only way I know how to do it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
a = {1, 3, 5};
b = {2, 4, 6};
:height &amp;lt;&amp;lt; color cells( {{"Red", a}, {"blue", b}} );
theScript = Char( :height &amp;lt;&amp;lt; get script );
theScript = Substr( theScript, Contains( theScript, "Color Cells" ) );
theScript = ":Name&amp;lt;&amp;lt;" || Substr(
	theScript,
	1,
	Contains( theScript, "Set Value" ) - 3
);
Eval( Parse( theScript ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1697603936194.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57748i3A78E1B4EDCE7062/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1697603936194.png" alt="txnelson_0-1697603936194.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 04:39:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688237#M87395</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-18T04:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688254#M87397</link>
      <description>&lt;P&gt;Thank Jim!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
m= 4 ;Column(m)&amp;lt;&amp;lt;set property("Color Gradient",{"Green to White to Red",Range({col min(Column(m)),col max(Column(m)),col mean(Column(m))})})&amp;lt;&amp;lt;Color Cell by Value;

//？？
theScript = Char( :height &amp;lt;&amp;lt; get script );
theScript = Substr( theScript, Contains( theScript, "Color Cells" ) );
theScript = ":Name&amp;lt;&amp;lt;" || Substr(
	theScript,
	1,
	Contains( theScript, "Set Value" ) - 3
);
Eval( Parse( theScript ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 05:15:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688254#M87397</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T05:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688273#M87398</link>
      <description>&lt;P&gt;I do not have a solution for a gradient color pattern.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 07:32:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688273#M87398</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-18T07:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688291#M87401</link>
      <description>&lt;P&gt;Thank Jim!&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;How do I get the fill color of a cell using JSL?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 07:51:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688291#M87401</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T07:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688316#M87403</link>
      <description>&lt;P&gt;One place where you could get the color is from report html. You will have to perform conversion though&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
m = 4;
Eval(EvalExpr(
	Column(dt, m) &amp;lt;&amp;lt; set property(
		"Color Gradient",
		{"Green to White to Red", Range({Expr(Col Min(Column(m))), Expr(Col Max(Column(m))), Expr(Col Mean(Column(m)))})}
	) &amp;lt;&amp;lt; Color Cell by Value;	
));

(dt &amp;lt;&amp;lt; get as report) &amp;lt;&amp;lt; get html;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 09:01:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688316#M87403</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-18T09:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688320#M87405</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;Complex I will not operate, can use the script to achieve?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks Experts!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-18_17-15-39.png" style="width: 405px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57770i86EC292AA8773E7E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-18_17-15-39.png" alt="2023-10-18_17-15-39.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 09:16:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688320#M87405</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T09:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688325#M87406</link>
      <description>&lt;P&gt;Also depending on how the gradient is created, you could maybe use Value Colors &lt;STRONG&gt;instead of&lt;/STRONG&gt; Gradient column property. Then you can get the colors from column properties.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 09:41:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688325#M87406</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-18T09:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688328#M87407</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;txt = dt &amp;lt;&amp;lt; get as report;
txt &amp;lt;&amp;lt; Save HTML( "c:\tt.html" );
u = "c:\tt.html";
For( k = 0, k &amp;lt;= 60, k++,
	Try( d1 = Open( u, HTML Table( k, Column Names( 1 ), Data Starts( 2 ) ) ) );
	Wait( 0 );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 09:48:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688328#M87407</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T09:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688341#M87408</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Ask experts how to use RE to get these content?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;How do I set the color in the name column after I get this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 10:24:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688341#M87408</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T10:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688343#M87409</link>
      <description>&lt;P&gt;EmEditor&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-10-18_18-49-47.png" style="width: 903px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57771i0ABE3681F3C0B665/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-10-18_18-49-47.png" alt="2023-10-18_18-49-47.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 10:53:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688343#M87409</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T10:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688511#M87420</link>
      <description>&lt;P&gt;Lots of assumptions made in this script and it definitely isn't robust&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
m = 4;
Eval(
	Eval Expr(
		Column(dt, m) &amp;lt;&amp;lt; set property(
			"Color Gradient",
			{"Green to White to Red", Range(
				{Expr(Col Min(Column(m))), Expr(Col Max(Column(m))), Expr(Col Mean(Column(m)))}
			)}
		) &amp;lt;&amp;lt; Color Cell by Value(1);
	)
);

// Lots of assumptions made in this solution

str = (dt &amp;lt;&amp;lt; get as report) &amp;lt;&amp;lt; get html;
// get just &amp;lt;table&amp;gt; and drop first row (headers)
l = Words(Regex(str, "&amp;lt;table.*&amp;lt;/table&amp;gt;"), "\!N");
Remove From(l, 1,2);
Remove From(l, N Items(l));

// Get bgcolors 
colors = {};
For Each({line}, l,
	str = Regex(line, "bgcolor=#(.*?)&amp;gt;", "\1");
	Insert Into(colors, str);
);

// Convert colors
// Option 1 (might work?)
jmp_colors = Transform Each({color}, colors, Hex To Number(color) * -1);

// Option 2
jmp_colors2 = Transform Each({color}, colors, 
	r = Hex To Number(Left(color, 2));
	g = Hex To Number(Substr(color, 3, 2));
	b = Hex To Number(Right(color, 2));
	RGB Color({r,g,b});
);

// Set colors

// One row at the time
For Each Row(
	:name &amp;lt;&amp;lt; Color Cells(jmp_colors[Row()], Row());
);

// Or create list of lists and use that
color_list = Transform Each({jmp_color, idx}, jmp_colors2,
	Eval List({jmp_color, idx});
);
Eval(EvalExpr(:age &amp;lt;&amp;lt; Color Cells(Expr(color_list))));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 17:09:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688511#M87420</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-18T17:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688557#M87428</link>
      <description>&lt;P&gt;be of no effect?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;l = Words(Regex(str, ""), "\!N");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 23:49:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688557#M87428</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-18T23:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688883#M87484</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I used the sentence JSL didn't get it right, for some reason, JMP 17&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;str = (dt &amp;lt;&amp;lt; get as report) &amp;lt;&amp;lt; get html;
// get just  and drop first row (headers)
l = Words(Regex(str, ""), "\!N");
Remove From(l, 1,2);
Remove From(l, N Items(l));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Oct 2023 07:27:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688883#M87484</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-20T07:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688884#M87485</link>
      <description>&lt;P&gt;Your regex pattern is incorrect&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 07:34:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688884#M87485</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-20T07:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688911#M87486</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(EvalExpr(:age &amp;lt;&amp;lt; Color Cells(Expr(color_list))));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class=""&gt;How do I modify this JSL to be a loop?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( j = 1, j &amp;lt;= N Row( dt ), j++,
	dt[j, "age"] &amp;lt;&amp;lt; color_list( {j} )//?
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 08:21:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688911#M87486</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2023-10-20T08:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use JSL to set the color gradient of a column in text format by the value of a numeric column?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688921#M87487</link>
      <description>&lt;P&gt;You can get the idea from Transform Each I used or use the other method with For Each Row&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 08:32:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-JSL-to-set-the-color-gradient-of-a-column-in-text/m-p/688921#M87487</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-20T08:32:09Z</dc:date>
    </item>
  </channel>
</rss>

