Fill color for multiple reference linesHi,
I have added multiple reference lines to the axis axis of a graph.
I´m doing this by looping through a reference line table (DarkLight) based on the main table.
Oxygen consumption = SableData << Graph Builder(<BR />Size( 1322, 944 ),<BR />Variables(<BR />X( :Name( "Time since first dose-[hours]" ) ),<BR />Y( :Name( "VO2-[ml/min]" ) ),<BR />Overlay( :Treatment )<BR />),<BR />Elements( Points( X, Y, Legend( 4 ) ) )<BR />);<BR /><BR />For( i = 1, i <= N Rows( DarkLight ), i++,
Report( Oxygen consumption )[AxisBox( 1 )] << add ref line( DarkLight:name("Time since first dose-[hours]")[i], DarkLight:Phase[i] )
);
Is there anyway I can add fill color in between some of the lines (based on column data in the DarkLight table) thereby indicating when it is daytime or nighttime?
Br Julie
Mass CustomizationRe: Fill color for multiple reference linesOk that makes sense. I missed the list part. Thanks for the response - I will change the reference table as you suggest.
Re: Fill color for multiple reference linesYour example does not add two references lines. It adds a colored region in the range when you supply a list with two values.
You might have to modify the reference data table that you construct. This example should illustrate the approach;
Names Default to Here( 1 );
// data table with reference line specifications
ref dt = New Table( "Reference Lines",
Add Rows( 5 ),
New Column( "Segment",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 3, 4, 5] )
),
New Column( "Low",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [50, 55, 60, 65, 70] )
),
New Column( "High",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [55, 60, 65, 70, 75] )
),
New Column( "Color",
Character,
"Nominal",
Set Values( {"Red", "Yellow", "Green", "Yellow", "Red"} )
)
);
data = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = data << Bivariate( Y( :weight ), X( :height ) );
x axis = Report( biv )[AxisBox(2)];
For Each Row( ref dt,
// draw colored regon
Eval( Eval Expr( x axis << Add Ref Line( { Expr( :Low ), Expr( :High ) }, "Solid", Expr( :Color ), , , 0.25 ) ) );
// draw border lines
Eval( Eval Expr( x axis << Add Ref Line( Expr( :Low ), "Solid", "Black" ) ) );
Eval( Eval Expr( x axis << Add Ref Line( Expr( :High ), "Solid", "Black" ) ) );
);Re: Fill color for multiple reference linesMy problem concerns this part in one of the suggestions:
Add Ref Line( {55, 65}, "Solid", "Black", "label", 1, 0.25 )This would add two ref lines at 55 and 65 and they have the same properties (solid, black etc).
If I need to add e.g. a 100 ref lines which change depending on the specific data set being run through the script and they need to be shown with different properties (e.g. one is dotted and red, the next one is solid and blue etc).
How would you do that without having to manually add each value in the script?
Re: Fill color for multiple reference linesYou iterate over the rows in your reference table and add a reference line (range) each time. Our answers did not involve the UI, only scripts, so it is not clear why you are confused or unable to proceed.
Re: Fill color for multiple reference linesThanks for the replies but this would require that I manually add the reference lines. My data set is constantly changing so I am looking for at solution where I can use the reference table that I have scripted to be created every time I run my data through this and automatically add the reference lines to the graph.
But I can´t seem to come up with a solution that adds different properties to the different ref lines when they are added like this.
Re: Fill color for multiple reference linesI knew how this message worked but when I went to the Scripting Index to get a reference for Julie, I discovered it is incomplete:

Re: Fill color for multiple reference linesReference lines can use a range of values, along with a transparency to blend the color with the background. This example using Big Class sample data produces the image below:
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate(
Y( :weight ),
X( :height ),
Fit Line( {Line Color( {212, 73, 88} )} )
);
(biv<<REPORT></REPORT>
