All I did to create the JSL for your chart, was to step through your stated steps, and copy the JSL from the log that JMP produced. I did add a little original code to solve the adding of zeros in for any work weeks where there vere no new fruits, but other than that, JMP created the JSL, not me
names default to here(1);
dt=data table("Fruit by date");
// New column: Column 3
Data Table( "Fruit by date" ) << New Column( "WW",
Numeric,
"ordinal",
Format( "Best", 12 ),
formula(week of year(:date))
);
// Data table summary
// → Data Table( "Fruit by date (1) By (Fruit, WW)" )
Data Table( "Fruit by date" ) << Summary(
Group( :Fruit, :WW ),
N( :Fruit ),
Freq( "None" ),
Weight( "None" )
);
// Change column formula: Count of WW
Data Table( "Fruit by date By (Fruit, WW)")<<
New column("Count of WW", Formula( Col Minimum( :WW, :Fruit ) ));
// Data table summary
// → Data Table( "Fruit by date By (Fruit, WW) By (Fruit)" )
Data Table( "Fruit by date By (Fruit, WW)" ) <<
Summary( Group( :Fruit ), Mean( :Count of WW ), Freq( "None" ), Weight( "None" ) );
// Data table summary
// → Data Table( "Fruit by date By (Fruit, WW) By (Fruit) By (Mean(Count of WW))" )
Data Table( "Fruit by date By (Fruit, WW) By (Fruit)" ) <<
Summary(
Group( :"Mean(Count of WW)"n ),
N( :"Mean(Count of WW)"n ),
Freq( "None" ),
Weight( "None" )
);
// Data table summary
// → Data Table( "Fruit by date By (WW)" )
Data Table( "Fruit by date" ) << Summary(
Group( :WW ),
Freq( "None" ),
Weight( "None" ),
link to original data table(0)
);
for each row(
:N Rows = 0;
);
:WW << set name("Mean(Count of WW)");
// Update data tables
Data Table( "Fruit by date By (WW)" ) << Update(
With( Data Table( "Fruit by date By (Fruit, WW) By (Fruit) By (Mean(Count of WW))" ) ),
Match Columns( :"Mean(Count of WW)"n = :"Mean(Count of WW)"n )
);
data table("Fruit by date by (WW)") << Graph Builder(
Size( 891, 456 ),
Show Control Panel( 0 ),
Variables( X( :"Mean(Count of WW)"n ), Y( :N Rows ) ),
Elements(
Bar(
X,
Y,
Legend( 5 ),
Summary Statistic( "Cumulative Sum" ),
Label( "Label by Value" )
)
)
)
Jim