private void paint_2d(ref ChartDataArray arrhistory, ref int[] DCCounts, int Count) { bool left2right = false; int hits = 200; if (left2right) { arrhistory.Length++; // Reach the max if (arrhistory.Length >= hits + 1) { arrhistory.Length = 0; arrhistory.Length++; } arrhistory[arrhistory.Length - 1] = new PointF(arrhistory.Length - 1, Convert.ToInt32(DCCounts[Count])); } else { if (arrhistory.Length <= hits + 1) { arrhistory.Length++; } //ShiftRight(arrHistory); cartogramPaint.ShiftRight(ref arrhistory); arrhistory[0] = new PointF(0, Convert.ToInt32(DCCounts[Count])); } DCCounts[Count] = 0;//清空实时放电量数据 }
/// <summary> /// Shift the PointData inorder to simulate a right to left plot drawing /// </summary> /// <param name="arr"></param> private void ShiftRight(ChartDataArray arr) { for (int i = arr.Length - 2; i >= 0; i--) { PointF p = (PointF)arr[i]; p.X++; arr[i + 1] = p; } }