大家好,
我被一个场景困住了。 我有一个可变性图,通过使用 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);
);