Reference > Structures > LineStyle Struct

LineStyle Struct

Line-styles (built-in and user-defined dash-repeat sequences).

public struct LineStyle

Public Constructor

Creates a custom dashed line from a vector of even length giving on-off pattern in points.

public LineStyle(
    double[] newDefinition  // int[] and Pen are also accepted here
);

Example

sp.SetContourStyle(Color.Red,LineStyle.Dash,1.2);
sp.SetDatumLineStyle(Color.Maroon,new LineStyle(new int[] {12,4,24,4})); // Long dashes

Public Static Properties

Dash

Specifies a dashed line

DashDot

Specifies a line with alternating dashes and dots

DashDotDot

Specifies a line with alternating dashes and paired dots

Dot

Specifies a dotted line

Invisible

Specifies an undrawn (invisible) line

Solid

Specifies a solid line

Creating Custom Dashed Lines

A dashed line is defined by an array of integers which give the on-off-on-off cycle in points. Custom lines are drawn with square ends to make the segments exactly the length you ask for. The cycle always begins at the start of the pattern (so the dash-offset is zero) here. For example:

LineStyle mydash = new LineStyle(new int[]{1,2,2,2,3,2,4,2});

Note that in charts rendered to SVG you can animate the dash-offset to give the effect of a ‘walking line’.

Using a Pen object with Raster Output

It is possible to use an existing .Net Pen object to create your line, but this method will only be effective in charts rendered to raster formats.

public LineStyle(
    Pen myPen
);

The color and Width of the pen will be overridden by the color setting and width of the line being drawn.

Requirements

Namespace: Causeway

Assembly: SharpPlot (in sharpplot.dll)

See also ...

SharpPlot Members | SetDatumLineStyle Method | SetGridLineStyle Method | SetLineStyles Method


Send comments on this topic
© Dyalog Ltd 2013