OnGraphDrawFlags
This attribute is new to Analytica 5.1
Attribute OnGraphDrawFlags
The attribute controls at which points OnGraphDraw is evaluated while a graph is being evaluated. It is an integer-valued bit-flags, which each corresponding bit set if OnGraphDraw should be called at that point. You can add any of the bits if you want it called at multiple stages.
The OnGraphDraw attribute can be called at four different points during the graph rendering. By default, it is called only after the graph has been rendered (equivalent to OnGraphDrawFlags=8). That is a useful point if you want to draw annotations on the graph over the data. The bit values are:
1 = Call before graphing has started. (Note: The layout info, such as the plot area, is not yet determined). 2 = Call after the layout has been determined, but before the grapher has drawn anything. 4 = Call after the background and axes have been drawn, but before data points, lines or bars have been drawn. 8 = (default) Call after the standard graphing has completed.
So for example, if you wanted to do something at stage after layout has been determined, but before anything has been rendered, you could set OnGraphDrawFlags to 10, which is 2 + 8. At that point, your OnGraphDraw code might need to branch on phase
like this:
If phase=2 Then ( «some code before drawing» ) Else If phase=8 Then ( «some code after drawing» )
Note: The If phase=8 Then
is unnecessary, since with OnGraphDrawFlags=10, we know that if phase<>2 then it must be 8.
To replace a graph entirely with a custom graphical depiction of your own, set OnGraphDrawFlags to 1, and then set continue:=0
from your OnGraphDraw code. In this case, OnGraphDraw won't be called again even if other bits are set.
To draw an image behind everything else, or alter the exact axis scaling, set OnGraphDrawFlags=2 flag. For example, this is a good time to draw a map and then twiddle the axis ranges to ensure proper map registration.
To draw in front the background, but behind the data, set OnGraphDrawFlags=4.
To annotate the graph or data with images in front of the data, set OnGraphDrawFlags=8.
Enable comment auto-refresher