Table of Contents

Class Plot

Namespace
PluginUI
Assembly
PluginUI.dll

Function / data plot with axes, grid and labels: linear or logarithmic X, several series, filled curves. Typical uses: EQ and filter response, compressor transfer curve, envelope or LFO shapes. iPlug2 IVPlotControl.

public class Plot : Control
Inheritance
Plot
Inherited Members

Remarks

Call InvalidateVisual() after changing what a function depends on.

Constructors

Plot()

Creates a plot.

public Plot()

Properties

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

FillBaseline

Y value the fills go to (default: 0 clamped into the range).

public double? FillBaseline { get; set; }

Property Value

double?

LogX

Logarithmic X axis (frequency plots; XMin must be > 0).

public bool LogX { get; set; }

Property Value

bool

PlotArea

Plot area (inside the labels) for the current bounds.

public Rect PlotArea { get; }

Property Value

Rect

Series

Curves, drawn in order.

public List<PlotSeries> Series { get; }

Property Value

List<PlotSeries>

ShowAxisLabels

Draws axis labels.

public bool ShowAxisLabels { get; set; }

Property Value

bool

ShowBackground

Draws the background panel.

public bool ShowBackground { get; set; }

Property Value

bool

ShowGrid

Draws the grid.

public bool ShowGrid { get; set; }

Property Value

bool

XGrid

Vertical grid lines in data units (null = automatic).

public IReadOnlyList<double>? XGrid { get; set; }

Property Value

IReadOnlyList<double>

XLabelFormatter

Formats X labels (default: compact numbers, "k" above 1000).

[Browsable(false)]
public Func<double, string>? XLabelFormatter { get; set; }

Property Value

Func<double, string>

XMax

Right of the X range.

public double XMax { get; set; }

Property Value

double

XMin

Left of the X range.

public double XMin { get; set; }

Property Value

double

YGrid

Horizontal grid lines in data units (null = automatic).

public IReadOnlyList<double>? YGrid { get; set; }

Property Value

IReadOnlyList<double>

YLabelFormatter

Formats Y labels.

[Browsable(false)]
public Func<double, string>? YLabelFormatter { get; set; }

Property Value

Func<double, string>

YMax

Top of the Y range.

public double YMax { get; set; }

Property Value

double

YMin

Bottom of the Y range.

public double YMin { get; set; }

Property Value

double

Methods

Add(Func<double, double>, Color?, bool)

Adds a function series (fluent).

public Plot Add(Func<double, double> function, Color? color = null, bool fill = false)

Parameters

function Func<double, double>
color Color?
fill bool

Returns

Plot

DataToX(double, Rect)

Data X → screen X.

public float DataToX(double x, Rect area)

Parameters

x double
area Rect

Returns

float

DataToY(double, Rect)

Data Y → screen Y.

public float DataToY(double y, Rect area)

Parameters

y double
area Rect

Returns

float

NiceTicks(double, double, int)

"Nice" tick values (1, 2, 5 × 10ⁿ) covering a range.

public static IEnumerable<double> NiceTicks(double min, double max, int approximateCount)

Parameters

min double
max double
approximateCount int

Returns

IEnumerable<double>

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle

XToData(float, Rect)

Screen X → data X.

public double XToData(float x, Rect area)

Parameters

x float
area Rect

Returns

double

YToData(float, Rect)

Screen Y → data Y.

public double YToData(float y, Rect area)

Parameters

y float
area Rect

Returns

double