FunctionGraphics

References
public class FunctionGraphics
Utility class for drawing function graphs, grip shapes and flourishes.

Fields

GripSize

#
public int GripSize
Gets or sets the base grip radius. Individual grip shapes add a small offset on top of this value (SolidDisc = +2, OpenDisc / SolidDiamond = +3, OpenDiamond = +4, arrows up to +7). Use MakeCompact() or MakeSpacious() to set both this and Thickness together.

ObscureDashPattern

#
public float[] ObscureDashPattern
Dash pattern applied to graphs of de-emphasised (Rank.Obscure) functions. Set to null or an empty array to draw obscure functions with a solid stroke. The pattern is in pixel units (on, off, on, off, ...).

Thickness

#
public int Thickness
Gets or sets the base graph curve thickness. 3 is considered normal for the UI, but if you're exporting images or drawing into a small area you may want to adjust it. Use MakeCompact() or MakeSpacious() to set both this and GripSize together.

Properties

Background

#
public Color Background { get; set; }
Background colour of the surface functions are drawn on. Used to resolve each function's FunctionUi.Tint into a concrete shade with adequate contrast. Defaults to white; set before rendering when drawing onto a differently-coloured surface.

Context

#
public Context Context { get; }
Gets the graphics context for these function graphics. Note that the context may use an entirely different set of panning and zooming transforms than the graph view and thus nothing should be drawn using this context without first applying the graph transforms. We recommend only using the draw methods directly exposed by these FunctionGraphics rather than relying on Context.Graphics.

Frame

#
public FrameF Frame { get; }
Gets the visible frame in graphics coordinates.

ScalarFont

#
public static Font ScalarFont { get; }
Gets the font used to draw scalar text.

UnitsPerPixel

#
public double UnitsPerPixel { get; }
Gets the number of graph paper units per pixel.

Methods

DrawAsymptote

#
public void DrawAsymptote(Color colour, double x)
Draw a standard vertical asymptote line.
colour (Color)
x (double)

DrawAsymptote

#
public void DrawAsymptote(Color colour, Line line)
Draw a standard asymptote line.
colour (Color)
line (Line)

DrawAsymptote

#
public void DrawAsymptote(Color colour, Point2d point0, Point2d point1)
Draw a standard asymptote line.
colour (Color)
point0 (Point2d)
point1 (Point2d)

DrawBox

#
public void DrawBox(Point2d centre, Vector2d span, Color edge)
Draw a box around a point.
centre (Point2d)Box centre.
span (Vector2d)Point 1.
edge (Color)Span vector (centre to corner).

DrawBox

#
public void DrawBox(Point2d point0, Point2d point1, Color edge)
Draw a box through two points.
point0 (Point2d)Point 0.
point1 (Point2d)Point 1.
edge (Color)Colour of box.

DrawCircle

#
public void DrawCircle(Point2d centre, double radius, Color edge)
Draw a circle around a point.
centre (Point2d)Centre point.
radius (double)Circle radius.
edge (Color)Colour of circle.

DrawCircle

#
public void DrawCircle(Point2d point0, Point2d point1, Color edge)
Draw a circle through two points.
point0 (Point2d)Point 0.
point1 (Point2d)Point 1.
edge (Color)Colour of circle.

DrawCross

#
public void DrawCross(float size, Point2d point, Color fill)
Draw an x-shaped grip.
size (float)Size of grip.
point (Point2d)Location.
fill (Color)Fill colour.

DrawFlourish

#
public void DrawFlourish(VectorArgument vector, FunctionArguments args, Color colour)
Draw a grip flourish.
vector (VectorArgument)
args (FunctionArguments)
colour (Color)

DrawGraph

#
public void DrawGraph(Point2d[] points, Color edge)
Draw a graph polyline.
points (Point2d[])Points to draw.
edge (Color)Graph colour.

DrawGraph

#
public void DrawGraph(Point2d[] points, Pen edge)
Draw a graph polyline.
points (Point2d[])Points to draw.
edge (Pen)Graph pen.

DrawGraphArea

#
public void DrawGraphArea(Point2d[] lower, Point2d[] upper, Color fill)
Draw an area graph.
lower (Point2d[])Points (left to right) of lower area boundary.
upper (Point2d[])Points (left to right) of upper area boundary./
fill (Color)Fill colour.

DrawGrip

#
public void DrawGrip(VectorArgument vector, FunctionArguments args, Color colour)
Draw a grip.
vector (VectorArgument)
args (FunctionArguments)
colour (Color)

DrawHorizontalAxis

#
public void DrawHorizontalAxis(Point2d point, Color edge)
Draw a horizontal axis flourish through a point.
point (Point2d)Point.
edge (Color)Colour of axis.

DrawInfiniteLine

#
public void DrawInfiniteLine(Point2d point0, Point2d point1, Color edge)
Draw an infinite line through two points.
point0 (Point2d)Point 0.
point1 (Point2d)Point 1.
edge (Color)Colour of line.

DrawLine

#
public void DrawLine(Point2d point0, Point2d point1, Color edge)
Draw a finite line segment between points.
point0 (Point2d)Point 0.
point1 (Point2d)Point 1.
edge (Color)Colour of line.

DrawLine

#
public void DrawLine(Point2d point0, Point2d point1, Pen edge)
Draw a finite line segment between points.
point0 (Point2d)Point 0.
point1 (Point2d)Point 1.
edge (Pen)Pen of line.

DrawOpenArrow

#
public void DrawOpenArrow(float size, Point2d point, Vector2d direction, Color fill, Color edge)
Draw an arrow head grip with an edge.
size (float)Size of grip.
point (Point2d)Location.
direction (Vector2d)Direction of arrow head.
fill (Color)Fill colour.
edge (Color)Edge colour.

DrawOpenDiamond

#
public void DrawOpenDiamond(float size, Point2d point, Color fill, Color edge)
Draw a diamond grip with an edge.
size (float)Size of grip.
point (Point2d)Location.
fill (Color)Fill colour.
edge (Color)Edge colour.

DrawOpenDisc

#
public void DrawOpenDisc(float size, Point2d point, Color fill, Color edge)
Draw a circular grip with an edge.
size (float)Size of grip.
point (Point2d)Location.
fill (Color)Fill colour.
edge (Color)Edge colour.

DrawScalars

#
public void DrawScalars(FunctionArguments args, Color colour)
Draw all scalars.
args (FunctionArguments)Collection of all scalars (required to find the parent of the scalar).
colour (Color)Colour of scalar.

DrawSolidArrow

#
public void DrawSolidArrow(float size, Point2d point, Vector2d direction, Color fill)
Draw an arrow head grip.
size (float)Size of grip.
point (Point2d)Location.
direction (Vector2d)Direction of arrow head.
fill (Color)Fill colour.

DrawSolidDiamond

#
public void DrawSolidDiamond(float size, Point2d point, Color fill)
Draw a diamond grip.
size (float)Size of grip.
point (Point2d)Location.
fill (Color)Fill colour.

DrawSolidDisc

#
public void DrawSolidDisc(float size, Point2d point, Color fill)
Draw a circular grip.
size (float)Size of grip.
point (Point2d)Location.
fill (Color)Fill colour.

DrawVerticalAxis

#
public void DrawVerticalAxis(Point2d point, Color edge)
Draw a vertical axis flourish through a point.
point (Point2d)Point.
edge (Color)Colour of axis.

FlourishPen

#
public Pen FlourishPen(Color colour)
Gets the edge used to draw flourishes. Called must dispose the edge when finished.
colour (Color)Colour.
Flourish edge.

MakeCompact

#
public void MakeCompact()
Set Thickness, GripSize and ObscureDashPattern to values suitable for small on-canvas drawings where graph area is at a premium.

MakeSpacious

#
public void MakeSpacious()
Set Thickness, GripSize and ObscureDashPattern to values suitable for large drawings (the pop-out editor, exported images).