Attached is an example data table. The script below tries to plot each parameter selected via the Local Data Filter in a new "Page" in Graph Builder. As it stands, the y-axis title is shown as "Median" every time a new "Parameter" is selected via the Local Data Filter.
I would like the Parameter name to be the y-axis title when new a parameter gets selected and plotted on a new "Page".
I tried using the filter change handler for this, but my script does not quite work. I think I need the index i below to be updated each time a new parameter is selected or may be there is another way. Any direction will be useful.
XPath( "//TextEditBox" ))[i]
here is my script
Names Default To Here (1);
Clear Log ();
gb = Graph Builder(
Size( 531, 325 ),
Show Control Panel( 0 ),
Variables( X( :PartID ), Y( :Median ), Page( :Parameter ), Color( :TestStage ) ),
Elements( Points( X, Y, Legend( 34 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :TestStage, :Parameter ),
Where( :TestStage == {"A", "B"} ),
Where( :Parameter == {"BKDVoltage", "Capacitance"} )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "myTitleGoesHere" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
if(ismissing(ldfText),ldfText = " Selected Test Parameter ");
(Report( gb ) << XPath( "//TextEditBox" ))[6] << Set Text(ldfText);
);
fsh = ldf << Make Filter Change Handler(changeTitle());
When it's too good to be true, it's neither