我已经编写了 JSL 来创建饼图(来自 Graph Builder):

我想用“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 的一部分,而是放在它上面的图片。我能够成功运行您的脚本来创建包含一张图片的日记。
如果图片是 2x2 记分卡的一部分怎么办?
例如:
- 带文本的外框
- 条形图
- 图片(带注释的饼图)
- 带表格的大纲框
在附加的脚本中,我将如何将图片与记分卡的其余部分结合起来?
完成此操作所需要做的就是将注释添加到图表,然后获取带有注释的脚本。一旦你有了它,一些小的改变,你就有了你的脚本。主要的变化是注释不会转移到期刊,而是通过将输出复制到图片结构中,然后将该图片发布到期刊,就可以得到你想要的最终结果。
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>