你好,
我想构建一个图表,该图表将从具有 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" )
)
)
)