Clip to PlotArea
New to Analytica 5.2
Use this function when writing drawing code inside OnGraphDraw when you want your drawn content to clip to the plot area rectangle only.
Clip_to_PlotArea( canv, info )
This is a utility function that you might find useful when creating your own annotation code or functions for use in OnGraphDraw.
Returns a drawing canvas clipped to the plot area of the graph. Called from OnGraphDraw, where «canv» and «info» are the local values
canv and <canv>info</canv> provided by the graphing engine to OnGraphDraw.
To use this function ,you must add the OnGraphDraw annotations.ana library to your model.
- Use File → Add Library... to add this library.
Given values x0 and y0, in data coordinates (i.e., x0 is in the coordinates of the variable depicted on the X-axis, y0 is in the coordinates of the variable depicted on the y-axis), and given a radius rx and ry, the following draws an ellipse centered at (x0, y0) with the radii (rx, ry):
The problem is that this drawn ellipse might extend outside the plot area, as seen here:
In this screenshot, the ellipse was contained within the data's axes when both axes were autoscaled, but once zoomed (i.e., manually scaled), the ellipse extends beyond the depicted axis ranges.
Use the Clip_to_PlotArea function to limit your drawing to the rectangle contained within the axes. The above example is modified as follows.