恒定的图例颜色你好,
我构建了一个图表(条形图)并通过右键单击并复制脚本更改了图例颜色(以及条形图颜色)
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties( 0, {Fill Color( 10 )}, Item ID( "category", 1 ) ),这是更大图表的一部分。
当我运行脚本并包含本地数据过滤器时,类别的颜色正在发生变化。 这是有害的,因为我希望独立于过滤器的类别具有相同的颜色。
亲切的问候,
回复:恒定的图例颜色您无法通过更改单元格颜色或将颜色的行状态更改为指定颜色来更改填充颜色。条形图是一个计算列,与显示和每个单独的行没有直接关系。因此,您需要通过更改图形生成器代码中的填充颜色来处理整个条形。以下是如何执行此操作的示例:
Graph Builder(
Size( 534, 418 ),
Show Control Panel( 0 ),
Variables( Y( :height ), Y( :weight, Position( 1 ) ) ),
Elements( Bar( Y( 1 ), Y( 2 ), Legend( 3 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
3,
Properties( 0, {Fill Color( 5 )}, Item ID( "Mean(height)", 1 ) ),
Properties( 1, {Fill Color( 5 )}, Item ID( "Mean(weight)", 1 ) )
)}
)
)
);
回复:恒定的图例颜色我对两列(高度和重量)中的所有单元格进行了着色,以在条形图中获得相同的颜色,但它不起作用
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:height << Color Cell By Value( 1 ); // turn on the cell coloring
For( i = 1, i <= N Row( dt ), i++,
If( Column( dt, "height" )[i] >= 0,
Column( dt, "height" ) << Color Cells( 5, {i} ),
Column( dt, "height" ) << Color Cells( 0, {i} )
));
:weight << Color Cell By Value( 1 ); // turn on the cell coloring
For( i = 1, i <= N Row( dt ), i++,
If( Column( dt, "weight" )[i] >= 0,
Column( dt, "weight" ) << Color Cells( 5, {i} ),
Column( dt, "weight" ) << Color Cells( 0, {i} )
));
Graph Builder(
Size( 534, 418 ),
Show Control Panel( 0 ),
Variables( Y( :height ), Y( :weight, Position( 1 ) ) ),
Elements( Bar( Y( 1 ), Y( 2 ), Legend( 3 ) ) )
);回复:恒定的图例颜色谢谢,
恐怕下一个问题的答案是显而易见的,但是如何通过脚本将列中的所有值更改为单一颜色?
回复:恒定的图例颜色您应该能够取消单击过滤器中的“包含”复选框,以允许图表的颜色保持不变。 “包含”复选框告诉过滤器在计算图表时包含/排除值,因此当未选中时,它将使用所有值,从而计算颜色并保存从过滤值到过滤值。回复:恒定的图例颜色您可以使用列属性 - 值颜色来锁定图例颜色。 这将确保无论您使用什么平台以及应用什么本地数据过滤器,每个组的颜色都不会改变。