Dear community,
I was looking for a histogram of a "variable" overlaid with "defects". For this I have made bins in "Variable_coded" column by using formula.
Next I have used graph builder, "Variable_coded" as X and overlaid "Output". I am also using "time" in data filter.
I have tried option "label by value". However, I want the graph builder to label Percentage against the "total within bin" on top of each bar.
Is it also possible to have total values in background which changes dynamically as I use filter. In other words, I want to merge these two graphs.
Thanks
dt = open("$Desktop\SampleData_Bt1.jmp");
dt << New Column( "Variable_coded",
Character,
"Nominal",
Formula(
List = {"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35",
"36", "37", "38", "39", "40"}[Loc Sorted(
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],
:Variable
)]
),
);
dt << select where (:Output == "GOOD");
dt << hide and exclude;
dt << Graph Builder(
Size( 1072, 922 ),
Lock Scales( 1 ),
Variables( X( :Variable_coded ), Overlay( :Output ) ),
Elements(
Bar( X, Legend( 10 ), Label( "Label by Value" ) ),
Caption Box( X, Legend( 11 ), Summary Statistic( "N" ) )
),
Local Data Filter(
Add Filter( columns( :time ), Where( :time >= 117.31 & :time <= 124.29 ) )
),
SendToReport(
Dispatch(
{},
"Variable_coded",
ScaleBox,
{Min( -0.5 ), Max( 17.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox,
{Min( 0 ), Max( 500 ), Inc( 50 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
10,
Properties(
2,
{Fill Color( 57 ), gradient(
{Scale Values( [0 1] ), Width( 9 ), N Labels( 6 )}
)}
)
)}
)
)
);
dt<<Graph Builder(
Size( 534, 463 ),
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :Variable_coded ) ),
Elements( Bar( X, Legend( 7 ) ) ),
Local Data Filter(
Add Filter( columns( :time ), Where( :time >= 117.31 & :time <= 124.29 ) )
),
SendToReport(
Dispatch(
{},
"Variable_coded",
ScaleBox,
{Min( -0.5 ), Max( 17.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox,
{Min( 0 ), Max(500 ), Inc( 50 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
7,
Properties(
0,
{Fill Color( 32 ), gradient(
{Scale Values( [0 1] ), Width( 9 ), N Labels( 6 )}
)}
)
)}
)
)
)