私は(Graph Builderから)円グラフを作成するためにJSLを書きました:

このPie Chartに(凡例の下に)「Responses:14」というテキストを注釈したいと思います。たとえば、

JSLでこれを行う方法はありますか?私の現在のスクリプトはファイルとして添付されています。
円グラフの絵の形を最終的な表示に組み込む方法を示すスクリプトを書き直しました。
/* Scorecard with Annotated Pie */
ClearLog();
NamesDefaultToHere(1);
dt1 = NewTable( "Table1", AddRows(5),
NewColumn( "Channel", Character, Nominal,
SetValues({"Call","Email","Facebook","Twitter","Visit"}) ),
NewColumn( "Pct of Customers", Continuous, Format("Percent"),
SetValues({.1, .05, .4, .35, .08}) )
);
dt2 = NewTable( "Table2", AddRows(5),
NewColumn( "Team Member", Character, Nominal,
SetValues({"Sales Asst A","Sales Asst B","Sales Asst C","Sales Asst D","Sales Asst E"}) ),
NewColumn( "Rating", Character, Nominal,
SetValues({"Excellent","Very Good","Excellent","Excellent","Excellent"}) )
);
dt = New Table( "Responses",
AddRows( 4 ),
New Column( "Status", Character( 7 ), "Nominal", Set Values( {"Late", "N/A", "On Time", "Pending"} ) ),
New Column( "Count", Numeric, "Continuous", Format( "Fixed Dec", 12, 0 ), Set Values( [2, 0, 11, 1] ) )
);
gb = dt << GraphBuilder(invisible,
Size( 150, 180 ),
ShowControlPanel( 0 ),
Variables( X( :Status ), Y( :Name( "Count" ) ) ),
Elements( Pie( X, Y, Legend( 2 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch({}, "400", ScaleBox, {LegendModel( 2,
Properties( 0, {FillColor({247, 150, 70})} ),
Properties( 1, {FillColor({200, 200, 200})} ),
Properties( 2, {FillColor({155, 187, 89})} ),
Properties( 3, {FillColor({192, 80, 77})} )
)}
),
Dispatch({}, "", GraphBuilderContainerBox, AddTextAnnotation(
Text("Responses 14"), TextBox({157, 102, 232, 135}), BackgroundColor("White")
)),
Dispatch( {}, "Graph Builder", OutlineBox, {SetTitle("Survey Responses")} ),
Dispatch( {}, "graph title", TextEditBox, {SetText("")} ),
Dispatch( {}, "X title", TextEditBox, {SetText("John Doe (pending)")} ),
Dispatch( {}, "Y title", TextEditBox, {SetText("")} ),
Dispatch( {}, "400", LegendBox, {SetTitle("")} )
)
);
thepicture = report(gb) << GetPicture;
win = NewWindow( "Customer Service Scorecard",
TextBox( "Customer Service Scorecard", <<SETFONTSIZE></SETFONTSIZE>ありがとう、ジム。
確かに、TextBoxは実際にはGraphBuilderの一部ではなく、むしろその上に配置された画像であることがわかります。 私はあなたのスクリプトを首尾よく実行して1枚の写真を含むジャーナルを作成することができました。
写真が2×2のスコアカードの一部だった場合はどうなりますか?
例えば:
- テキスト付きのOutlineBox
- 棒グラフ
- 画像(注釈付き円グラフ)
- テーブル付きOutlineBox
添付のスクリプトで、写真とスコアカードの他の部分をどのように組み合わせますか。
これを達成するためにしなければならないのは、チャートに注釈を追加してから、注釈を付けてスクリプトを取得することだけです。 それができたら、いくつかの小さな変更とあなたのスクリプトがあります。 主な変更点は、注釈がジャーナルに転送されないことですが、出力を画像構造にコピーしてからその画像をジャーナルに投稿することで、目的の結果が得られます。
Clear Log();
Names Default To Here( 1 );
dt = New Table( "Responses",
AddRows( 4 ),
New Column( "Status", Character( 7 ), "Nominal", Set Values( {"Late", "N/A", "On Time", "Pending"} ) ),
New Column( "Count", Numeric, "Continuous", Format( "Fixed Dec", 12, 0 ), Set Values( [2, 0, 11, 1] ) )
);
total = 14;
thetext = "Responses\!n" || char(total);
win = New Window( "Scorecard",
gb = dt << GraphBuilder(
Size( 150, 180 ),
ShowControlPanel( 0 ),
Variables( X( :Status ), Y( :Name( "Count" ) ) ),
Elements( Pie( X, Y, Legend( 2 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
2,
Properties( 0, {Fill Color( {247, 150, 70} )} ), /* Late: orange */
Properties( 1, {Fill Color( {200, 200, 200} )} ), /* N/A: grey */
Properties( 2, {Fill Color( {155, 187, 89} )} ), /* On Time: green */
Properties( 3, {Fill Color( {192, 80, 77} )} ) /* Pending: red */
)}
),
Dispatch(
{},
"",
GraphBuilderContainerBox,
Add Text Annotation(
Text( theText ),
Text Box( {159, 94, 232, 133} ),
Background Color( "White" )
)
),
Dispatch( {}, "Graph Builder", OutlineBox, {SetTitle( "Survey Responses (Q3 2017)" )} ),
Dispatch( {}, "graph title", TextEditBox, {SetText( "" )} ),
Dispatch( {}, "X title", TextEditBox, {SetText( "John Doe (pending)" )} ),
Dispatch( {}, "Y title", TextEditBox, {SetText( "" )} ),
Dispatch( {}, "400", LegendBox, {SetTitle( "" )} )
)
)
);
thepicture=report(gb)<<GET picture=""></GET>