BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted

Re: how to change the color of a line

Hi Alex,

Sorry for the delayed response. 

Say you have the following Legend Model message being sent.

Legend Model( 2, Properties( 1, {Line Color( 4 )} ) )
  • The first argument (2) is a unique ID refering to a specific Legend Model within the ScaleBox. In the above example, a value of 1 would refer to the Legend Model containing the points, while a value of 2 points to the smoother lines.
  • The second argument (Properties( 1, {Line Color( 4 )} )) contains information about which element within the Legend Model to apply a given set of properties.
    • The first argument within Properties (1) is a zero-based item number to identify which item to apply the new property.
    • The second argument within Properties ({Line Color( 4 )}) is a list of properties to apply to a given Legend Model item. In this case, we are changing the line color to green.

Here are a few examples:

The following script sets the first item in the first legend model (points) to be green. In this case, the first item is "F."

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
gb = dt << Graph Builder(
	Show Control Panel( 0 ),
	Grid Transparency( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model( 1, Properties( 0, {Line Color( 4 )} ) )}
		)
	)
);

(From here on out, I will just give the Legend Model portion to replace in the above script)

 

The following Legend Model snippet will change the color of the second item ("M") within the points legend model.

Legend Model( 1, Properties( 1, {Line Color( 4 )} ) )

The following Legend Model snippet will change the color of the first item ("F") within the smoother line legend model.

Legend Model( 2, Properties( 0, {Line Color( 4 )} ) )

The following Legend Model snippet will change the color of the second item ("M") within the smoother line legend model.

Legend Model( 2, Properties( 1, {Line Color( 4 )} ) )

NOTE:  changing the line color of the smoother line also will change the color of the corresponding points, but changint the point color of the points does not affect the color of the associated smoother line.

 

Justin