Hello,
I have this script that creates multipe graphs and appends them in a report. since every user has its own resolution, sometimes the graph look too big or too small on their laptop. i know you can re-size the graph with dragging the corener, but when there's 8 graphs, that becomes a tedious task.
this is my general code, at the end is the script i created, the problem is, it only resizes the last graph that was created.
Build_chart = Function( {param},
gb = dt1 << Graph Builder(
Size( x, y ),
Show Control Panel( 0 ),
Automatic Recalc( 1 ),
Variables( X( :MEASUREMENT_DATE ), Y( :CHART_VALUE )),
Elements( Points( X, Y, Legend( 1 ), Jitter( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Where( :parameter == param );
);
filter << append(
tool_filter = Outline Box( "General data filter",
V List Box( "Slider Box",
tb = Text Box( "Value: " || Char( sliderValue ) ),
sb = Slider Box( 0.4, 1, sliderValue, chart_size )
)
)
);
For( j = 1, j <= N Items( param_list ), j++,
graph << append( Report( Build_chart( param_list[j] ) ) )
);
chart_size = Expr(
xr=sb<<GET></GET>thanks in advanced!
Hi, thanks it works, besides the first graph in the report. maybe i need to ditch the "Report" in the foor loop?
the function build_chart builds the chart. and yes theres a v_list box where it appends it to.
EDIT: i had to change a panel box to v list box and now it works.
I am confused by your script; I don't see where the object graph is defined and you are appending graph builder boxes to it.
Assuming graph is a container box, such as, OutlineBox, VListBox, ScrollBox, etc. something like this should work, where w is the calculated width, similar for h.
Xpath finds all graphbuilder elements and stores it in a list (_xx), and any valid message sent to this list is applied to all items in the list.
_xx = graph << XPath( "//GraphBuilderBox");
_xx << set width( w ) << set height( h ) ;