Ciao,
Voglio costruire un grafico che mostrerà cumulativo di soli nuovi articoli per settimana da una tabella che ha 2 colonne (vedi allegato come esempio). Nella tabella ci sono 91 diversi tipi di frutta che si collegano alla data che va dal 02/01/2024 al 29/09/2024. Di seguito è riportato il grafico desiderato. I passaggi che ho fatto finora per ottenere il grafico non sembrano troppo efficaci/efficienti. Mi chiedo se qualcuno abbia un modo più efficace (JSL) per farlo?
Passi che ho usato per generare il grafico:
1) creare una colonna nella stessa tabella con Formula(Week Of Year(:Date)).
2) riassumere la tabella N(Frutta) per Frutta e WW
3) nella tabella riassuntiva di 2), aggiungi una colonna (Count of WW) con Formula(Col Min(:WW, :Fruit))
4) tabella riassuntiva Media (Conteggio di WW) per Frutta
5) tabella riassuntiva N(Media(Conteggio di WW)) per Media(Conteggio di WW). Quindi aggiungo manualmente righe con valore = 0 a qualsiasi WW mancante perché quella settimana non ha nuovi frutti. Questa è la tabella che ho usato per costruire il grafico usando statistica = cumulativo.

Tutto quello che ho fatto per creare il JSL per il tuo grafico è stato eseguire i passaggi indicati e copiare il JSL dal registro prodotto da JMP.Ho aggiunto un piccolo codice originale per risolvere l'aggiunta di zeri in qualsiasi settimana lavorativa in cui non ci fossero nuovi frutti, ma a parte questo, JMP ha creato il JSL, non io

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" )
)
)
)