Click here to Skip to main content
14,766,117 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
HI there everyone;

i'm new developer of c#, i wanted to plot the data which is comming from serial port, i wrote some code but it din't work for me, are there any suggestions for me to do it easily?


 public void draw_Graph(object sender, EventArgs e)
        {
            _xvalue = new double[Larray.Length];
            _yvalue = new double[Larray.Length];
            for (int i = 0; i < Larray.Length; i++)
            {
//Larray is the byte variable from filestream. i saved it to stream.
                _xvalue[i] = i;
                _yvalue[i] = Convert.ToDouble(Larray[i]);
            }
            _myPionts = new PointPairList(_xvalue, _yvalue);
            LineItem _myLine = _myPane.AddCurve("Sine Wave", _myPionts, Color.Black, SymbolType.None);
            _myLine.Line.IsAntiAlias = true;
            _myLine.Line.IsSmooth = true;

            zedGraphControl1.AxisChange();
            zedGraphControl1.Invalidate();
            zedGraphControl1.Refresh();
        }

this is the function which i made program compiles and runs but it doesn't plot anything.
Posted
Comments
Sergey Alexandrovich Kryukov 18-Sep-13 17:50pm
   
Don't you think it would be useful to explain the detail of the problem? Your "didn't work for me" and "doesn't plot anything" is not too informative. Did you even use the debugger to see what's going on?
We have no idea what is placed in your Larray, do you?
—SA
Member 10741366 23-Jul-14 5:22am
   
Did you solve this problem..? Even I am facing the same type of problem. I am able to read data but using data to plot I have no idea.

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