Annoter le graphique à secteurs (de Graph Builder) avec JSLJ'ai écrit JSL pour créer un camembert (de Graph Builder):

Je voudrais annoter ce camembert (sous sa légende) avec un texte indiquant "Réponses : 14", par exemple :

Existe-t-il un moyen de le faire avec JSL?Mon script actuel est joint sous forme de fichier.
ScriptRe : Annoter le graphique à secteurs (de Graph Builder) avec JSLJ'ai retravaillé le script, montrant comment la forme d'image du camembert peut être incorporée dans l'affichage final
/* 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>Re : Annoter le graphique à secteurs (de Graph Builder) avec JSLMerci Jim.
OK, je vois que le TextBox ne fait pas réellement partie de GraphBuilder, mais plutôt une image placée dessus.J'ai pu exécuter votre script avec succès pour créer un journal contenant une image.
Et si l'image faisait partie d'un tableau de bord 2x2 ?
Par exemple:
- OutlineBox avec texte
- Diagramme à bandes
- Image (graphique circulaire avec annotation)
- OutlineBox avec tableau
Dans le script ci-joint, comment combinerais-je l'image avec le reste du tableau de bord ?
Re : Annoter le graphique à secteurs (de Graph Builder) avec JSLPour ce faire, il suffit d'ajouter l'annotation au graphique, puis d'obtenir le script avec l'annotation.Une fois que vous avez cela, quelques modifications mineures et vous avez votre script.Le changement majeur était que l'annotation ne serait pas transférée dans le journal, mais en copiant la sortie dans une structure d'image, puis en publiant cette image dans le journal, on obtient les résultats finaux souhaités.
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>