使用 JSL 編輯顏色漸變比例大家好,
例如我有這個數據表

test = Graph Builder(
Variables( X( :X ), Y( :Y ), Color( :Value ) ),
Elements( Points( X, Y, Legend( 23 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
23,
Properties(
0,
{gradient(
{Scale Values( [-2 2] ), Label Format( "Fixed Dec", 15, 3 )}
)},
Item ID( "Value", 1 )
)
)}
)
)
);我運行上面的腳本來獲取下面的圖表,其顏色梯度為 +/-2 標準差。 如果數據集很大,這有助於不顯示傳單。
在下圖中,我唯一要做的就是右鍵單擊顏色漸變並將比例類型更改為線性(因為以線性比例思考更容易)。 我正在努力編寫這一步的腳本。

請注意,我不想要下面的圖表,它只是調整梯度之前製作圖表時的默認圖表。

我得到的最接近的值如下,但它設置了從 -2 到 2 的線性縮放,這是我輸入的標準偏差限制。
test << Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
3,
Properties(
0,
{gradient(
{ Scale Values[ ], Label Format( "Fixed Dec", 15, 4 ),
Scale Type( "Linear" )}
)},
Item ID( "Entry X Offset", 1 )
)
)}
)任何想法都非常感激! - 埃文
回复:使用 JSL 編輯顏色漸變比例這是一個示例,我動態確定其中一列的梯度。
dt = New Table( "Untitled", Add Rows( 4 ),
New Column( "X", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 2, 3, 4] ) ),
New Column( "Y", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [4, 1, 3, 2] ) ),
New Column( "Value", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 1, 2, 2] ) )
);
dtcol = column(dt, "Y");
one_min = col min(dtcol);
one_max = col max(dtcol);
one_avg = col mean(dtcol);
scale_matrix = matrix({one_min, one_avg, one_max});
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :X ), Y( :Y ), Color( :Value ) ),
Elements( Points( X, Y, Legend( 9 ) ) ),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 9,
Properties( 0,
{gradient( {Scale Values( scale_matrix )} )},
Item ID( "Value", 1 )
)
)}
)
)
);回复:使用 JSL 編輯顏色漸變比例練習的目的是了解 JSL GB 為定制秤生成的內容。一旦獲得,您就可以通過編程方式確定每個數據集的縮放比例,並在運行時將其替換到 GB JSL 中。
回复:使用 JSL 編輯顏色漸變比例謝謝回复!
不過,我不想在圖形生成器中進行任何手動工作。 我的(較大的)腳本的想法是自動製作許多圖表,並為每個圖表和數據集進行適當的縮放。 要查看模式,需要針對每列/數據集單獨調整比例。 手動做的事情太多了。回复:使用 JSL 編輯顏色漸變比例在 GB 中處理圖表並將比例設置為您想要的值。然後單擊紅色小三角並選擇腳本 > 保存到腳本窗口。這是我稍微改變比例後得到的結果:
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :X ), Y( :Y ), Color( :Value ) ),
Elements( Points( X, Y, Legend( 9 ) ) ),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 9,
Properties( 0,
{gradient( {Scale Values( [2.2 2.6 3.2] )} )},
Item ID( "Value", 1 )
)
)}
)
)
);