/// <summary> /// This function is the paint function for the line drawing /// </summary> private void Plateau_Plot_Line_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; // Draw lines between each two consecutive points for(int i = 0; i < SortedPoints.Count-1; i++) { gPts P1 = new gPts(); gPts P2 = new gPts(); P1 = FindPixelCoord((System.Drawing.Point)SortedPoints[i]); P2 = FindPixelCoord((System.Drawing.Point)SortedPoints[i+1]); P1.X += 8; P1.Y += 9; P2.X += 8; P2.Y += 9; g.DrawLine(new System.Drawing.Pen(LINE_COLOR, 2.0f), P1.X, P1.Y, P2.X, P2.Y); } }
/// <summary> /// Special Paint function for the Plateau Plot /// </summary> private void Plateau_Plot_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; for(int i = 0; i < this.PlottedPoints.Count; i++) { thePoint = FindPixelCoord((System.Drawing.Point)this.PlottedPoints[i]); // Draw it g.DrawString(PT_SYMBOL, new Font("Arial",12,System.Drawing.FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black),thePoint.X, thePoint.Y); } }
/// <summary> /// This function will calculate the pixel coordinates of a data point /// </summary> /// <param name="point">Data point to be plotted</param> /// <returns>Point with new coordinates</returns> private gPts FindPixelCoord(System.Drawing.Point point) { gPts temp = new gPts(); temp.X = point.X; temp.Y = point.Y; // Get actual Pixel coordinate from plot coordinate temp.X *= 4; // there are four pixels per decibel on the X axis temp.X += this.PlotArea.Location.X; // account for location offset temp.Y -= minThresholdLvl; // subtract off min Threshold level temp.Y *= 5; // there are 50 pixels every 10 db in the Y axis temp.Y = 376 - temp.Y; // min threshold on Y is at pixel 376 // Adjust the Fudge Factor // temp.X += 4; temp.Y -= 7; return temp; }