Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...
I in my project drawn a Triangle wave
The component Zedgraoh : How Wave motion in zedgraph ?

this Code :

C#
private void CreateGraph(ZedGraphControl zgc)
		{
			GraphPane myPane = zgc.GraphPane;
			// Make up some data points from the Sine function
            PointPairList list1 = new PointPairList();
            double amplitude = double.Parse(textBox1.Text);
            double period = double.Parse(textBox3.Text);  
            double y = 0;
            for (double x = 0; x <= double.Parse(textBox2.Text); x += .005)
            {
                double p = (x % (period)) / period;
                if (p >= 0 && p <= 0.25)
                    y = 4 * p * amplitude;
                if (p > 0.25 && p < 0.5)
                    y = amplitude - (p - 0.25) * 4 * amplitude;
                if (p > 0.5 && p <= 0.75)
                    y = -4 * (p - 0.5) * amplitude;
                if (p > 0.75 && p <= 1)
                    y = -(amplitude - (p - 0.75) * 4 * amplitude);
                list1.Add(x, y);
            }
            var line = zg1.MasterPane[0].AddCurve("", list1, Color.Blue); 
            line.Symbol.IsVisible = false;
            zg1.AxisChange();
            zg1.Refresh();			
			zgc.AxisChange();
		}


and this pic :
http://s5.picofile.com/file/8150989518/110033.png[^]
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900