你好,
我正在編寫一個腳本,該腳本將處理具有各種列的文件,因此我必須修改我在此處找到的一個示例,該示例根據列數連接圖形生成器調用。儘管很笨拙,但它似乎確實有效,但我的問題是我想將 X 軸更改為對數比例、更改限制等。我嘗試了腳本索引和示例中的一些方法,但似乎都不起作用。
非常感謝在軸設置上指向正確方向的指針,但如果有人知道如何更好地完成初始繪圖部分,那就太好了,謝謝!
dt = Current Data Table();
ColNameList = dt << Get Column Names (continuous, string);
//Start with initial graph builder
GraphExpr = "
TestGraph = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables(";
//Add X Entry
GraphExpr = GraphExpr || "
X( :Name( \!"" || ColNameList[1] || "\!") ),";
//Add the first Y entry
GraphExpr = GraphExpr || "
Y( :Name( \!"" || ColNameList[2] || "\!") ),";
//Add the second Y entry
For( i = 3, i <= N items (ColNameList), i++,
GraphExpr = GraphExpr || "
Y( :Name( \!"" || ColNameList[i] || "\!"), Position (1) ),";
);
//Close out Variables section
GraphExpr = GraphExpr || "
),
Elements(
Line( X, Y( 1 )";
//Build out the lines for all columns
For( i = 2, i <= N items (ColNameList), i++,
GraphExpr = GraphExpr || ", Y( " || char(i) || " )"
);
GraphExpr = GraphExpr || ", Legend( 1 )
)
)
)";
eval(parse(GraphExpr));
TestGraph << Show Legend (0);
是否有描述如何為漸變圖例設置完成此操作?
我試過
Report( gb)[Legend Box(1)] << Legend Model( ...
但沒用
嘿吉姆,感謝您對此的快速回复。效果很好。我沒有意識到您需要使用 report() 來引用該圖形項,我只是嘗試使用 TestGraph[AxisBox(2)] << scale(log)
謝謝,
托德
所有更改軸的消息都可以在 AxisBox 的腳本索引條目中找到
你想要使用的是
report(TestGraph)[AxisBox(2)] << scale(log);
你好,
這確實是構建圖形生成器表達式的相當複雜的方法。 您可能想研究用“佔位符”定義整個 GB 表達式的方法 (gbe = Expr (Graph Builder(...)); 使用替代函數用列、變量、標籤等替換佔位符。 ,然後使用Eval() 函數生成圖表(抱歉,我現在沒有時間提供更多詳細信息)
對於您的具體問題,如果您將 Graph Builder 表達式分配給變量(例如,gb = Graph Builder (...);),則可以使用下面的方法以您需要的任何方式更新軸:
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables(
X( :age, Size( 23 ) ),
Y( :height, Size( 37 ) ),
Y( :weight, Position( 1 ), Size( 37 ), Side( "Right" ) )
),
Elements( Points( X, Y( 1 ), Legend( 1 ), Jitter( 1 ) ), Points( X, Y( 2 ), Legend( 3 ), Jitter( 1 ) ) )
);
framebox = Report( gb )[framebox( 1 )];
framebox << Y Axis(
Scale ("Log"),
Add Ref Line( 61.25, "Solid", "Medium Dark Green" ),
Show Major Grid( 1 ),
Show Minor Grid( 1 ),
Format( "Fixed Dec", 5, 2 ),
Rotated Labels( "Perpendicular" )
);我希望這有幫助。
最好的,
TS
大家好,
我有類似的問題,關於如何自動化 X 軸,即時間刻度,我希望它自動顯示最後一個所需週期的資料。例如(n=7)。
非常感謝您的幫忙。
神聖
我的腳本如下:

Hi Pmroz,<BR />Script with JSL, <BR />Thank you,<BR />
// → Data Table( "GSB" )
Local( {obj},
obj = Data Table( "GSB" ) <<
Graph Builder(
Size( 604, 659 ),
Variables(
X(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
)
),
Overlay( GSB Validation )
),
Elements(
Bar(
X,
Legend( 11 ),
Bar Style( "Stacked" ),
Summary Statistic( "% of Factor" ),
Label( "Label by Value" )
)
),
Local Data Filter(
Add Filter(
columns(
:"Inferred Value (Yes/No)"n,
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
)
),
Where( :"Inferred Value (Yes/No)"n == "Yes" ),
Where(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
) == {3755376000, 3758054400, 3760473600, 3763152000, 3765744000,
3768422400, 3771014400, 3773692800, 3776371200, 3778963200,
3781641600}
),
Display(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
),
N Items( 15 )
)
)
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Monthly GSB Validation (%)" )}
),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "%" )} ),
Dispatch( {}, "Where((Inferred Value (Yes", TextBox, {Hide( 1 )} )
)
);
obj << Save Script to Data Table(
"Monthly GSB Validation (%)", <<REPLACE> = 12, y + 1, w / m >= 52, y - 1, y ) ) ||如果( w >= 10, "W", "W0" ) || Char( w ) ) ) ) )、大小( 570, 619 )、變數( X( :"年週[測量日期]"n )、疊加( :最佳產品) )、元素(長條圖( X, 圖例( 2 ) , 條形樣式( "Stacked" ), 摘要統計( "% of Factor" ), 標籤( "Label by Value" ) ) ), 本地資料過濾器( 新增過濾器( columns( :"年周[測量日期]"n ) , 其中( :"年週[測量日期]"n == {"2023W48", "2023W49", "2023W50", "2023W51", "2023W52", "2024W01", "20240W "2024W03", "2024W04 ", "2024W05", "2024W06", "2024W07", "2024W08"} ), Display( :"年週[測量日期]"n, N 項( 15 ), Find( 設定文字( "" ) ) ) ) ), SendToReport( Dispatch( {}, "其中(年周[測量日期] = 2023W48, 2023W49, 2023W50, 2023W51, 2023W52, 2023W50, 2023W51, 2023W52, 2023W50, 2023W51, 2023W52, 2024202,02020 5, 2024 W06、2024W07、 2024W08)",文字框,{隱藏( 1 )} ) ) );</REPLACE>