Here is a modification that handles the elimination of the black outline
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Stock Prices.jmp" );
dt << New Column( "tip", formula( Format( :Date, "yyyymmdd" ) ) );
dt << delete columns( "Date" );
dt << New Column( "new", set each value( Row() ) );
dt << New Column( "Direction", character, set each value( If( :Open <= :Close, "Increasing", "Decreasing" ) ) );
dt << run formulas;
Column( "tip" ) << deleteFormula;
dt:open << label;
dt:close << label;
gb = dt << Graph Builder(
Size( 1289, 456 ),
Show Control Panel( 0 ),
Variables( X( :new ), Y( :High ), Y( :Low, Position( 1 ) ), Color( :Direction ) ),
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 10 ), Bar Style( "Interval" ) ) ),
SendToReport(
Dispatch( {}, "new", ScaleBox, {Interval( "new" ), Inc( 1 ), Minor Ticks( 0 )} ),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
10,
Properties( 0, {Fill Color( light red )}, Item ID( "Decreasing", 1 ) ),
Properties( 1, {Fill Color( light green )}, Item ID( "Increasing", 1 ) ),
Properties( 0, {Line Color( 19 ), Line Width( 2 )}, Item ID( "High..Low", 1 ) )
)}
)
)
);
// Add the boxes to the chart
Report( gb )[framebox( 1 )] << add graphics script(
//halfDayincr = In Days( 1 ) / 2 * .8;
//days = (Col Max( :Date ) - Col Min( :Date )) / In Days( 1 );
halfDayincr = .4;
days = Col Max( :new ) - Col Min( :new );
Pen Size( 1 );
For( i = 1, i <= N Rows( dt ), i++,
If( :Open[i] <= :close[i],
Pen Color( light green );
Fill Color( light green );
,
Pen Color( light red );
Fill Color( light red );
);
Rect( :new[i] - halfDayincr, Max( :open[i], :close[i] ), :new[i] + halfDayincr, Min( :open[i], :close[i] ), 1 );
Rect( :new[i] - halfDayincr, Max( :open[i], :close[i] ), :new[i] + halfDayincr, Min( :open[i], :close[i] ), 0 );
);
);
Concerning how to manually/interactively
- Drag the high and low columns to the Y axis drop area
- Drag the new column to the X axis drop area
- Right click on the chart and select Smoother=>Remove
- Right click on the chart and select Points=>Change=>Bar
- Right click on the chart and select Bar=>Bar Style=>Interval
- Drag the Direction column to the Color drop area
- In the legend, right click on the color box for Increasing and select Fill Color=>select a light green color
- In the legend right click on the color box for decreasing and select Fill Color=>select a light red color
- Now the boxes for each high and low need to be added. This is done by adding a graphic script to Graph Builder
- Right click on the chart and select Customize
- Click on the + box to add a new script
- In the script editor area, add the following script (the script is developed by the individual user. In this case, I wrote the script)
halfDayincr = 0.4;
days = Col Max( :new ) - Col Min( :new );
Pen Size( 1 );
For( i = 1, i <= N Rows( dt ), i++,
If( :Open[i] <= :Close[i],
Pen Color( light green );
Fill Color( light green );
,
Pen Color( light red );
Fill Color( light red );
);
Rect(
:new[i] - halfDayincr,
Max( :Open[i], :Close[i] ),
:new[i] + halfDayincr,
Min( :Open[i], :Close[i] ),
1
);
Rect(
:new[i] - halfDayincr,
Max( :Open[i], :Close[i] ),
:new[i] + halfDayincr,
Min( :Open[i], :Close[i] ),
0
);
);
Click on OK
Jim