For my project, I need to add and update real-time data to my double y-axis graph. The values of Y and Y2 have the same value of X, and I already created it. Now I have a function that adds new pairs of points to the lists of curves.
Here is my problem: the values of Y and Y2 are always added to the list of curves of the first curve. How can I get the Y2 value added to the second list of the curve in my graph?
Here is my function code:
private void AddDataToGraph(ZedGraphControl zg1, XDate xValue, double yValue1, double yValue2)
{
if (zg1.GraphPane.CurveList.Count <= 0)
return;
LineItem curve = zg1.GraphPane.CurveList[0] as LineItem;
if (curve == null)
return;
IPointListEdit list = curve.Points as IPointListEdit;
IPointListEdit list2 = curve.Points as IPointListEdit;
if (list == null || list2 == null)
return;
list.Add(xValue, yValue1);
list2.Add(xValue, yValue2);
zg1.Invalidate();
}
How can he add Y2 values to the second list of curves?
source
share