I have a script where I use Page By to create a set of graphs. I want to add different reference lines to each graph, pulled from a list.
Currently the only way I know how to specify which graphs to add the reference lines to is by referring to the graph by its integer index (which seems to start at 2) using ScaleBox. (Please let me know if there's a better way than using the integer index.) E.g.:
For( i= 1, i<= n, i+=1,
RefLineValue= RefLineList[i];
mygraph << SendToReport(
Dispatch(
{},
"Data",
ScaleBox( i+1 ),
{Add Ref Line( RefLineValue, "Solid", "Black", "", 1 )}
);
)
);This almost works, but my issue is that I don't know how to get the integer index specified properly for the ScaleBox function. The Page By function seems to put the graphs into some kind of alphabetical order, so I thought if I use Sort List( RefLineList ) then the ordering of the list would match the ordering of the graphs.
But ordering doesn't quite match: E.g. if the variables in the Page By role are [A50, B50, B100] then the graphs will be ordered [A50, B50, B100] but the list created using Sort List will be ordered [A50, B100, B50].
Is there a way to specify the Page By graph by name instead of by integer index? And if not, is there a way to sort my list so the list order matches the graph order?