Subscribe Bookmark RSS Feed

Change Graph Builder properties when using local data filter?

seburke89

Community Trekker

Joined:

Jun 4, 2015

Hi all,


I'm writing a script for a graph that will become a part of another function. The graph has X2 on the X-axis and a group y variable Y. I know I can set the number of levels for Y directly in the script, but I also have a local data filter with the graph so that the user can look at the effect of X2 & y for different values of another variable X. For different values of this variable X, the number of levels of Y can change. Is there a way in the JSL script to change the number of levels of Y in the graph when a new option in the local data filter is selected? I've been trying to use a row state handler, but can't seem to find the right function call to change the number of levels in the graph. Thanks for your help! Sarah

g = Graph Builder(

    Show Control Panel( 0 ),

    Variables( X( :X2), Group Y( :Y, Levels(10) ), Color( :Group ) ),

    Elements( Points( X, Legend( 5 ), Jitter( 0 ) ) )

);

ldf= g << Local Data Filter(Mode, Add Filter(columns(:X), Display( :X , Single Category Display )));

doSomethingWithSelection = Function({x},

    {Default Local},

    rows = ldf << get filtered rows;

    in = Column(dt, "Y") << get values;

    in = in[rows];

    numUniqueRows = nrow(getUniqueValues(in)); //separate function I wrote...

    //change/update number of levels of y in graph g using numUniqueRows

);

gbReport = g << Report;

rsh = gbReport[OutlineBox(1)] << MakeRowStateHandler(doSomethingWithSelection);