圖形產生器堆疊長條圖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 )
)
)}
)
)
);