cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SpannerHead
Level III

Auto Annotate Plots

I have created a script to take a spec document and apply spec limits and notes to a data file.  I was trying to come up with a way to automatically add the notes input as an annotation to the subsequent plots.

 

I came up with this with a lot of help from the user community.  Wondering if there are obvious opportunities to make the script more flexible in terms of plot types that can auto annotate?

clear Globals();

Delete Symbols();



dt=Current Data Table();

cd=Column Dialog(

       exy =

       ColList( "Y",

              Min Col( 1 ),

              Max Col( 100 ),

       ),

       exx =

       ColList( "X",

              Min Col( 1 ),

              Max Col( 10 ),

       ),



);





eval(cd[1]);eval(cd[2]);

yyy=expr(y());

xxx=expr(x());

xval = exx[1];

for (i=1, i<=nitems(exy), i++,

insert into(yyy, exy[i]));

for (i=1, i<=nitems(exx), i++,

insert into(xxx, exx[i]));



nw = New Window( "Annotated Multiple Plots", V List Box( vlb = v List Box() ) );



For( i = 1, i <= N Items( exy ), i++,

Notes = exy[i] << Get Property( "Notes" );

       plots = V List Box(

       oneway( x( exx[1] ), y( exy[i] ),

              SendToReport(

              Dispatch(

                     {},

                     "Oneway Plot",

                     FrameBox,

                     Add Text Annotation(

                           Text( "Category: " || Notes ),

                           Fixed Size( 0 ),

                           Text Box( {0, 0, 0, 0} ),

                           Filled( 0 ),

                           Font( "Segoe UI", 10, "Bold" )

                     )

              ) )

       ));

       vlb << append( plots );

);

 

 

If you see any opportunities to improve this script, I’m open to suggestions?

 

Thanks

 

Dec

1 REPLY 1
txnelson
Super User

Re: Auto Annotate Plots

Your Y column input needs to have a restriction placed on it to insure that only numeric columns can be specified.

Jim