PointPairList 繼承自 System.Object → System.Collections.CollectionBase → ZedGraph.CollectionPlus,用於儲存 PointPair (X, Y) 座標點集合。
LineItem myCurve = myPane.AddCurve("Porsche", list1, Color.Red, SymbolType.Diamond);
AddCurve 將資料點以指定名稱、顏色、符號繪製於 Pane。LineItem,可進一步設定線條屬性。SymbolType 列舉 12 種標記形狀(如 Diamond、Circle、Square 等)。myPane.Title = "My Test Graph\n(For CodeProject Sample)";
myPane.XAxis.Title = "My X Axis";
myPane.YAxis.Title = "My Y Axis";
base.ZedGraphControl.AxisChange(); // 重新計算座標軸範圍並刷新
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
for (int i = 0; i < 36; i++) {
double x = i + 5;
double y1 = 1.5 + Math.Sin(i * 0.2);
double y2 = 3.0 * (1.5 + Math.Sin(i * 0.2));
list1.Add(x, y1);
list2.Add(x, y2);
}
透過正弦函數生成兩組波形資料,分別對應兩條曲線。