大家好,
我繪製了一些數據,並將圖表分成兩部分。一部分代表“好”,一部分代表“壞”,分別以綠色和紅色長條圖表示。
是否可以在圖中新增第三部分,顯示 x 軸總值中「壞」值的百分比?請參閱附圖。
謝謝。
你可以做你想做的,但你需要稍微改變你的數據。您需要將數據拆分為 ji 和 nein 列
表格=>拆分
然後調出 Graph Builder。在圖形生成器中,右鍵單擊新的 ji 或 nein 列並創建一個新的轉換公式列。使用以下公式為轉換列創建百分比值
( ji + nein ) / nein
然後在 Graph Builder 窗口中拖入 X 列。然後將 nein 列拖動到 Y 軸。接下來將 ji 列拖到 Y 軸的底部,將其作為單獨的圖表添加,最後,將 percent 列拖到 Y 軸的底部。 您可以根據需要調整每個 Y 軸。
下面是一個使用提供的大類示例數據表的簡單示例。

和生成圖形的 JSL
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables(
X( :age ),
Y( :height ),
Y( :weight ),
Y(
Transform Column(
"Percent",
Formula( ((:weight + :height) / :weight) * 1 )
)
)
),
Elements( Position( 1, 1 ), Bar( X, Y, Legend( 35 ) ) ),
Elements( Position( 1, 2 ), Bar( X, Y, Legend( 34 ) ) ),
Elements( Position( 1, 3 ), Bar( X, Y, Legend( 33 ) ) ),
SendToReport(
Dispatch(
{},
"height",
ScaleBox,
{Min( 0 ), Max( 125 ), Inc( 20 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"Percent",
ScaleBox,
{Format( "Percent", 9, 1 ), Min( 0 ), Max( 4 ), Inc( 0.5 ),
Minor Ticks( 1 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
35,
Properties( 0, {Fill Color( 19 )}, Item ID( "Mean(height)", 1 ) )
), Legend Model(
34,
Properties( 0, {Fill Color( 20 )}, Item ID( "Mean(weight)", 1 ) )
), Legend Model(
33,
Properties( 0, {Fill Color( 9 )}, Item ID( "Mean(Percent)", 1 ) )
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {35, [2], 34, [1], 33, [0]} ), Position( {2, 1, 0} )}
)
)
)