3

I have points of the form (x,y) and I need to plot these points on a graph(line graph).The graph needs to be continuous and not discrete.This I need to do in C# using some API for graphs and not by graphics library.Please suggest how to do and If possible please share the code as well.

0

2 Answers 2

3

If you can use standard Chart control from Windows Forms, then this code:

chart1.ChartAreas[0].Axes[0].Title = "N";
chart1.ChartAreas[0].Axes[1].Title = "FIB(N)";
chart1.Series[0].ChartType = SeriesChartType.Line;
chart1.Series[0].MarkerStyle = MarkerStyle.Circle;
chart1.Series[0].LegendText = "Fibonacci numbers";
Tuple<int,int> t = Tuple.Create(0,1);

for(int i = 1; i <= 30; i++){
  chart1.Series[0].Points.Add(new DataPoint(i, t.Item1));
  t = Tuple.Create(t.Item2, t.Item1 + t.Item2);
}

This will draw Fibonacci Sequence continuous XY graph.

Sign up to request clarification or add additional context in comments.

Comments

2

If you can use WPF then check out Dynamic Data Display. They even have a demo of a continuous graph that re-scales as it goes along.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.