你好,
我正在嘗試使用圖形生成器創建堆疊條形圖,其中包含每個堆疊條形的標籤以及總計。下圖是我希望實現的圖表的標記版本,我手動插入了每個條形的總計。(附上我使用的示例 JMP 數據集以及嵌入式圖形生成器腳本)
有誰知道是否有辦法通過圖形生成器/另一個平台或 JSL 腳本創建此視圖?
謝謝,
愛華

@tx尼爾森, @gzmorgan0
非常感謝您的快速回復和解決此問題的創造性方法!我忘記提到,我每週需要為大約 100 個不同的項目循環瀏覽並生成這些圖。所以,我認為 gzmorgan0 提供的腳本更適合我。 我剛剛嘗試了一下,它非常適合我的需求。再次感謝!
@AW ,
@tx尼爾森提供了很好的解決方案。 標籤需要一些腳本。這是使用 GraphBuilder 的另一種方法。我認為通過保存的腳本(如下)更容易看到模式。 這可以通過 UI 並關閉 Overlay 變量來完成。 該圖有 3 個元素:
- 使用覆蓋變量的堆疊條
- 不使用覆蓋變量的欄
- 不使用疊加變量的摘要統計總和的標題
注意我將您的數據表保存到我的 c:/temp/ 驅動器中。 Caption elemnet 不具備 Jim 的解決方案提供的放置靈活性。
Names Default to Here(1);
dt = open("C:/temp/Sample Dataset for Stacked Graph Builder Bar Chart.jmp");
gb = dt << Graph Builder(
Size( 534, 492 ),
Show Control Panel( 0 ),
Variables(
X( :Test_Step_Duration ),
Y( :Test ),
Group X( :Sample Information ),
Overlay( :Test_Step )
),
Elements(
Bar(
X,
Y,
Overlay( 0 ),
Legend( 11 ),
Bar Style( "Stacked" ),
Summary Statistic( "Sum" )
),
Caption Box(
X,
Y,
Overlay( 0 ),
Legend( 13 ),
Summary Statistic( "Sum" ),
Per Factor( 1 )
),
Bar( X, Y, Legend( 14 ), Bar Style( "Stacked" ), Label( "Label by Value" ) )
),
Local Data Filter(
Add Filter( columns( :Project ), Where( :Project == "Project 1" ) )
),
SendToReport(
Dispatch(
{},
"Test_Step_Duration",
ScaleBox,
{Label Row( Show Major Grid( 1 ) )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
11,
Properties(
-1,
{Transparency( 0.1 )},
Item ID( "Sum(Test_Step_Duration)", 1 )
)
), Legend Model(
14,
Properties( 0, {Fill Color( 69 )}, Item ID( "Step 1", 1 ) ),
Properties( 1, {Fill Color( 67 )}, Item ID( "Step 2", 1 ) ),
Properties( 2, {Fill Color( 36 )}, Item ID( "Step 3", 1 ) ),
Properties( 3, {Fill Color( 40 )}, Item ID( "Step 4", 1 ) ),
Properties( 4, {Fill Color( 38 )}, Item ID( "Step 5", 1 ) ),
Properties( 5, {Fill Color( 39 )}, Item ID( "Step 6", 1 ) )
)}
),
Dispatch(
{},
"X title",
TextEditBox,
{Set Text( "Test_Step_Duration and Total" )}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {11, [-1], 14, [0, 1, 2, 3, 4, 5]} ),
Position( {-1, 0, 1, 2, 3, 4, 5} )}
)
)
);
txtseg = gb << Xpath("//TextSeg");
txtseg << Set Font("Segoe UI", 10, "Bold");
txtseg[1] << {Transparency( 0 ), Text Color( "White" )}; //clear out the statistic

您可以將自己的自定義圖形腳本添加到圖形生成器,右鍵單擊圖形,然後選擇“自定義”,您將看到添加的 JSL。我只添加了前 2 個欄的代碼,但它應該向您展示如何繼續處理所有這些欄。

附上腳本