SharpPlot Reference > SharpPlot Methods > DrawPolygon Method

SharpPlot.DrawPolygon Method

Draw polygon from x and y coordinates, with optional Color, edge width, and FillStyle.

Example

sp = new SharpPlot(180,120);
sp.SetMargins(12,12,18,4);
sp.ScatterPlotStyle = (ScatterPlotStyles.GridLines|ScatterPlotStyles.ForceZero);
sp.SetColors(Color.Black);
sp.SetPenWidths(1);
sp.DrawScatterPlot(new double[]{1.2,5.3,2.9,7.4,1.3,4.3,6.4,7.7},new double[]{1.2,
         9.1,4.3,3.2,7.5,4.5,6.7,7.8});
sp.DrawPolygon(new double[] {4,8,8,4,4},new double[] {4,4,8,8,4},Color.Red,
         FillStyle.Opacity30,(double)1,LineStyle.Dash);
sp.DrawPolygon(new double[] {2,9,9,6,6,2,2},new double[] {1,1,3,3,5,5,1},Color.Blue,
         FillStyle.Opacity30,(double)0,LineStyle.Invisible);

Description

If the polygon is drawn before any chart, the co-ordinates used are points, measured from the top left corner of the paper.

If the polygon is drawn after a chart, the chart axes are used as the co-ordinate system for polygon points.

Overloads

See also ...

SharpPlot Members


Send comments on this topic
© Dyalog Ltd 2021