Here is an approach that uses the JSL written by the platform (in this case, Graph Builder) to find the elements.I include it to illustrate the following:
- expr ( )
- name expr ( )
- arg ( )
- head ( )
- << get scriptable object (this returns the Graph Builder object from which you obtain the script)
You'll want to read up on these in the scripting guide if you've not used them before. They're powerful but require some practice.
Since I have not put any conditionals in (you'd want to do that... check window names, etc.), do the following to make sure the script works as written below.
1) Close current reports and graphs.
2) Create a Graph Builder graph.
3) Run the script below in a script window. (You could also wrap this in an external loop to cycle through more than one graph window. Again, this is just a skeletal script meant to illustrate the overall idea.)
Cheers,
Brady
Names Default To Here( 1 );
winList = Get Window List( Type( "reports" ) );
obj = winlist[1][Outline Box( 1 )] << Get Scriptable Object;
script = obj << get script;
i = 1;
//move through the script's arguments until you get to the Variables ( ) argument.
While( Head( exp = Arg( Name Expr( script ), i ) ) != Expr( Variables ), i++ );
xList = ylist = {};
nexp = name expr ( exp ); //optional; this allows us to type nexp instead of name expr ( exp ) in the code below.
//cycle through the arguments in the Variables ( ) section. If X ( ) or Y ( ) is
//encountered, insert into the appropriate list.
For( i = 1, i <= N Arg( nexp ), i++,
If( Head( var = Arg( nexp, i ) ) == Expr( X ), Insert Into( xList, Arg( Name Expr( var ), 1 ) ));
If( Head( var = Arg( nexp, i ) ) == Expr( Y ), Insert Into( yList, Arg( Name Expr( var ), 1 ) ));
);
Show( xList, yList );