Ho scritto JSL per creare un grafico a torta (da Graph Builder):

Vorrei annotare questo grafico a torta (sotto la sua leggenda) con il testo "Risposte: 14", ad esempio:

C'è un modo per farlo con JSL? Il mio script attuale è allegato come un file.
Ho rielaborato la sceneggiatura, mostrando come la forma dell'immagine del grafico a torta può essere incorporata nel display finale
/* 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>Grazie, Jim.
OK, vedo che il TextBox non è in realtà parte di GraphBuilder, ma piuttosto un'immagine posta sopra di esso. Sono riuscito a eseguire correttamente lo script per creare un diario contenente un'immagine.
Cosa fare se l'immagine faceva parte di una scorecard 2x2?
Per esempio:
- OutlineBox con testo
- Grafico a barre
- Immagine (grafico a torta con annotazione)
- OutlineBox con tabella
Nello script allegato, come combinare l'immagine con il resto della scheda punteggi?
Tutto ciò che si deve fare per ottenere questo risultato è aggiungere l'annotazione al grafico e quindi ottenere lo script con l'annotazione. Una volta che hai questo, alcune modifiche minori e hai il tuo script. Il cambiamento principale è stato che l'annotazione non è stata trasferita sul giornale, ma copiando l'output in una struttura di immagine e quindi postando quella foto sul diario, si hanno i risultati finali desiderati.
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>