Drawing a Line given both x and y values

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 example illustrates a mathematical curve, with computed x and y values. The ‘curves’ style works well for examples like this, as many fewer intermediate points are required to give a pleasing result.

It is called a Fibonacci spiral, and cuts the x-axis at the classic Fibonacci series values of 1 1 2 3 5 8 and so on.

LineGraph3
SharpPlot sp = new SharpPlot();
sp.Heading = "Fibonacci Series for Real Numbers";

xdata = new double[] {-6.0,-5.9, .... 5.9,6.0};
ydata = FibFn(xdata);

sp.SetXDatumLines(0);
sp.SetYDatumLines(0);

sp.DrawLineGraph(ydata,xdata);

See also

LineGraph1 LineGraph2 LineGraph3 LineGraph4