Click here to Skip to main content
14,843,569 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I need to add points to a curve one by one and display the curve after every point has been added (since the graph is only updated ever two seconds). Before I was adding all 64 points to a list, then drawing a curve based on list elements.

Here is the code I have so far.

c#
private void CreateGraph(ZedGraphControl zgc)
{
    GraphPane myPane = zgc.GraphPane;

    // Set the titles and axis labels
    myPane.Title.Text = "My Test Graph";
    myPane.XAxis.Title.Text = "X Value";
    myPane.YAxis.Title.Text = "My Y Axis";

    // Make up some data points from the Sine function
    //PointPairList list = new PointPairList();

    // Generate a blue curve with circle symbols , and "My Curve 2" in the legend
    //myPane.AddCurve("My Curve", list , Color.Blue, SymbolType.XCross);
    double x = (int)arrayPosition;
    double y = (int)dataArray[arrayPosition];
    myCurve.AddPoint(x, y);
    // Fill symboles with black
    //myCurve.Symbol.Fill = new Fill(Color.Black);
    // Fill the axis background with a color gradient
    myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);

    // Fill the pane background with a color gradient
    myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F);

    // Calculate the Axis Scale Ranges
    zgc.AxisChange();
    zgc.Refresh();
    zgc.GraphPane.CurveList.Clear();
}


the problem is I don't know how to display the myCurve in myPane.
There is a function .draw, but I have no idea how to use it, and haven't found anything helpful googleing so far. Any help would be appreciated.

*Edit*
I think I have explained what I want to do, and put in all relevant code, but if you need any clarification just ask.
Posted
Updated 18-Jul-12 1:54am
v2

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