你好,
我想構建一個圖表,該圖表將從具有 2 列的表中按周顯示僅新項目的累積(參見附件示例)。 在表格中,有 91 種不同類型的水果鏈接到從 01/02/2024 到 9/29/2024 的日期。 下面是所需的圖表。 到目前為止,我為獲取圖表所採取的步驟似乎不太有效/高效。 我想知道是否有人有更有效的 (JSL) 方法來做到這一點?
我用來生成圖表的步驟:
1)在同一個表中使用公式(Week Of Year(:Date))創建一列。
2) 按 Fruit 和 WW 匯總表 N(Fruit)
3) 在 2) 的匯總表中,用 Formula(Col Min(:WW, :Fruit)) 添加一列 (Count of WW)
4) 匯總表 Mean(Count of WW) by Fruit
5) 匯總表 N(Mean(Count of WW)) by Mean(Count of WW)。 然後,我手動將值 = 0 的行添加到任何缺失的 WW,因為那一周沒有新水果。 這是我用來使用 statistic = cumulative 構建圖表的表格。

我為您的圖表創建 JSL 所做的一切就是逐步完成您規定的步驟,並從 JMP 生成的日誌中復制 JSL。我確實添加了一些原始代碼來解決在沒有新成果的任何工作周中添加零的問題,但除此之外,JMP 創建了 JSL,而不是我

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