大家好,
我被一個場景困住了。 我有一個可變性圖,通過使用 by 子句兩次,該圖在一個窗口中有 8 個不同的圖。 一種情況有兩個選項,我想添加一個行圖例,其中一列用於一種情況,另一列用於另一種情況,因為一種情況的值顏色設置不同。
下面是我正在嘗試但無法顯示行圖例的 JSL 代碼。 任何幫助,將不勝感激。
dt = Open("$SAMPLE_DATA/Cars.jmp");
Column(dt, "Size" ) << Set Property( "Value Colors", {"It" = 0} );
vc = Variability Chart(
Y( :Wt ),
X( :Model ),
Show Range Bars( 0 ),
Show Cell Means( 0 ),
Std Dev Chart( 0 ),
By( :"D/P"n, :Protection )
);
If (Column(dt, "D/P"n)[1] == "Driver",
vc << Row Legend("Doors");
);
If (Column(dt, "D/P"n)[1] == "Passenger",
vc << Row Legend("Size");
);

上面的示例是理想的情況,如果 d/p=“Driver”,則將門添加為行圖例並使用常規顏色。 但是,如果 d/p="passenger" size 添加為行圖例,並且由於 size 的值顏色設置為黑色,它將自動添加它,因為它應該如我之前的問題所示: https://community.jmp.com/t5/Discussions/JSL-coloring-single-element-of-legend-to-a-custom-color/mp/676602#M86324
謝謝,如果可能的話,我理想地尋找 JSL 代碼來執行此操作!
行圖例設置為框架框

所以你必須將行圖例設置為不同的框架框。 您可以循環遍歷框架框或使用其他一些方法來獲取對框架框的引用(XPath)。 下面是使用循環的示例
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cars.jmp");
Column(dt, "Size") << Set Property("Value Colors",
{"comp" = -15113984, "hev" = -5682409, "lt" = 0, "med" = -29362, "mini"
= -13983232, "mpv" = -13400487, "pu" = -16442434, "van" = -9282864}
);
wait(0);
vcs = dt << Variability Chart(
Y(:Wt),
X(:Model),
Show Range Bars(0),
Show Cell Means(0),
Std Dev Chart(0),
By(:"D/P"n, :Protection)
);
obs = vcs << report;
// ob_titles = obs << get title;
For Each({cur_ob, idx}, obs,
//cur_ob = obs[1];
cur_title = cur_ob << get title;
If(Contains(cur_title, "Variability Gauge D/P=Driver"),
cur_ob[FrameBox(1)] << Row Legend("Doors");
, Contains(cur_title, "Variability Gauge D/P=Passenger"),
cur_ob[FrameBox(1)] << Row Legend("Size", Color Theme(""));
, // else (do nothing)
continue();
);
// show(cur_title, idx);
);