SharpPlot Reference > SharpPlot Methods > DrawLineGraph Method

SharpPlot.DrawLineGraph Method

Constructs a linegraph or surface plot from an array of data values. This chart is typically used to show timeseries data, but may also be used with an explicit set of X-values to draw any mathematical curve.


sp = new SharpPlot(180,120);
sp.LineGraphStyle = LineGraphStyles.Risers;
data = new int[] {18,27,31,12,19,23};

The short tutorial shows a few of the possibilities and some sample code.



Linegraphs are most commonly used to represent data which changes over time (stock prices or currency values are typical) but may be used wherever pairs of X and Y values are joined by lines. The default is to join the points with straight lines, but for some applications (for example illustrating a graph of Y-squared versus X) then it is better to use smooth curves.

This chart has a wide variety of styles, for example it can draw risers from the X-axis, fill the surface, add arrowheads to the end of each line, and so on. These styles can be combined as required by calling DrawLineGraph several times with different style settings to overlay multiple charts on the same set of axes.

See also ...

Line graphs and Time series | SharpPlot Members | SharpPlot.LineGraphStyle Property

Send comments on this topic
© Dyalog Ltd 2021