图形生成器堆叠条形图JMP 17 附件是一个简单的数据表,其中包含每月的零件总数、故障总数、故障总数百分比以及参数失败的各个数字。 我想要的堆积条形图是 X 轴上的月份和 Y 轴上的总失败百分比。 然后我希望这些条形图与参数失败的突破堆叠在一起,按每个参数的每月百分比计算。 下面是我在 ppt 中绘制的屏幕截图,见图 1。 我无法在图形生成器中得到它。 我尝试堆叠数据、操作列,但没有成功。
总之,我希望 Y 轴上失败部件的总体百分比作为条形,然后该条形显示每个月失败的每个参数的百分比。 下面附有示例数据表。 谢谢。
图。1

数据探索和可视化视窗回复:图形生成器堆叠条形图吉姆:
感谢您的答复。 我不知道多系列堆栈选项,所以这是一个很好的提示。 您生成的图表的唯一问题是 Y 轴。 我正在寻找每月的总百分比作为栏的整体高度。 因此,一月为 10%,二月为 4%,三月为 15%。 Y 轴是每月失败的总体百分比。 然后,每个条形图将被细分为失败参数的百分比。 1 月 10% 整体标准将细分为 20% Parm 1 / 80% Parm 2。 2 月 4% 的总体条形将细分为 16.7% Parm 1 / 50% Parm 2 / 33.3% Parm 3。 然后,3 月 15% 的总体条形将细分为 37% Parm 1 / 29.6% Parm 2 / 33.3% Parm 3。 我可能需要进一步调整表格,因为到目前为止我还无法通过图形生成器实现它。 再次感谢。
回复:图形生成器堆叠条形图您想要的图表需要更改数据表的结构以及某些数据表的行状态和列状态的设置。

下面的脚本改变了数据表的结构,然后绘制了上面的最终图表。脚本中的所有内容都可以交互完成。事实上,一切都是交互式完成的,然后我只需将 JMP 提供的脚本复制到一个最终脚本中。
Names Default to here(1);
dt = current data table();
dtStack = dt <<
Stack(
columns(
:Parm 1 # Fails, :Parm 2 # Fails, :Parm 3 # Fails, :Parm 1 % Fail,
:Parm 2 % Fail, :Parm 3 % Fail
),
Source Label Column( "Parameter" ),
Stacked Data Column( "Counts" ),
Number of Series( 2 ),
Contiguous
);
// Change the name of the column that has the % values
dtStack:Counts 2 << set name("Percent");
// Divide each row value for the percent column to conform
// to the percent values for a JMP column
for each row(
:Percent = :Percent / 100;
);
// Change the display format for the percent column to
// display a % sign in the values
dtStack:Percent << format("Percent", 7, 0);
// A column needs to be set to have the correct display values for
// the legend. Also, the alphabetical ordering will determine the
// order of the subbar values. So recode the column to meet those
// specifications
// Recode column: Parameter
Local( {dt},
dt = dtStack;
dt << Begin Data Update;
dt << Recode Column(
dt:Parameter,
{Map Value(
_rcOrig,
{"Parm 1 # Fails", "3. Parm 1", "Parm 2 # Fails", "2. Parm 2",
"Parm 3 # Fails", "1. Parm 3"},
Unmatched( _rcNow )
)},
Update Properties( 1 ),
Target Column( :Parameter )
);
dt << End Data Update;
);
// Label column: Percent to be used to label the graph
dtStack:Percent << Label( 1 );
// Label all rows to show which values from the percent column
// to label
dtStack << Select All Rows << Label(1);
dtStack << clear selection;
dtStack << invert row selection;
// Draw the graph
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :Month ), Y( :Counts ), Overlay( :Parameter ) ),
Elements(
Bar( X, Y, Legend( 7 ), Bar Style( "Stacked" ), Label( "Label by Row" ) )
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
7,
Properties(
0,
{Fill Color( 73 )},
Item ID( "1. Parm 3", 1 )
),
Properties(
1,
{Fill Color( 25 )},
Item ID( "2. Parm 2", 1 )
),
Properties(
2,
{Fill Color( -7183127 )},
Item ID( "3. Parm 1", 1 )
)
)}
)
)
);
这是用于创建最终图表的重组数据表。

回复:图形生成器堆叠条形图吉姆:
我终于通过图形生成器找到了一些工作。 感谢您提供的解决方案。 您指出的多重系列以及本练习的代码对未来有很大帮助。 再次感谢你。
回复:图形生成器堆叠条形图更改为总计的百分比是一个简单的数学公式,给出堆叠数据表中的列。我刚刚添加了一个名为 % of Total 的新列,然后在图表中将其用作 Y 轴

Names Default To Here( 1 );
dt = Current Data Table();
dtStack = dt << Stack(
columns(
:Parm 1 # Fails, :Parm 2 # Fails, :Parm 3 # Fails, :Parm 1 % Fail,
:Parm 2 % Fail, :Parm 3 % Fail
),
Source Label Column( "Parameter" ),
Stacked Data Column( "Counts" ),
Number of Series( 2 ),
Contiguous
);
// Change the name of the column that has the % values
dtStack:Counts 2 << set name( "Percent" );
dtStack << New Column( "% of Total", Format( "Percent", 7, 0 ) );
// Divide each row value for the percent column to conform
// to the percent values for a JMP column
For Each Row(
:Percent = :Percent / 100;
:"% of Total"n = :counts / :Total Fails * (:total % Fail / 100);
);
// Change the display format for the percent column to
// display a % sign in the values
dtStack:Percent << Format( "Percent", 7, 1 );
// A column needs to be set to have the correct display values for
// the legend. Also, the alphabetical ordering will determine the
// order of the subbar values. So recode the column to meet those
// specifications
// Recode column: Parameter
Local( {dt},
dt = dtStack;
dt << Begin Data Update;
dt << Recode Column(
dt:Parameter,
{Map Value(
_rcOrig,
{"Parm 1 # Fails", "3. Parm 1", "Parm 2 # Fails", "2. Parm 2",
"Parm 3 # Fails", "1. Parm 3"},
Unmatched( _rcNow )
)},
Update Properties( 1 ),
Target Column( :Parameter )
);
dt << End Data Update;
);
// Label column: Percent to be used to label the graph
dtStack:Percent << Label( 1 );
// Label all rows to show which values from the percent column
// to label
dtStack << Select All Rows << Label( 1 );
dtStack << clear selection;
dtStack << invert row selection;
// Draw the graph
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :Month ), Y( :"% of Total"n ), Overlay( :Parameter ) ),
Elements(
Bar( X, Y, Legend( 7 ), Bar Style( "Stacked" ), Label( "Label by Row" ) )
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
7,
Properties( 0, {Fill Color( 73 )}, Item ID( "1. Parm 3", 1 ) ),
Properties( 1, {Fill Color( 25 )}, Item ID( "2. Parm 2", 1 ) ),
Properties(
2,
{Fill Color( -7183127 )},
Item ID( "3. Parm 1", 1 )
)
)}
)
)
);