public virtual void Draw(Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis) { Pen p; if (this.pen_ != null) { p = (System.Drawing.Pen) this.pen_; } else { p = new Pen(this.color_); } for (int i = 0; i < data_.Count; ++i) { PointD p1 = data_[i]; if (!Double.IsNaN(p1.X) && !Double.IsNaN(p1.Y)) { // TODO: probably should check for p2, p3 too. PointD p2; PointD p3; if (i + 1 != data_.Count) { p2 = data_[i + 1]; p2.Y = p1.Y; p3 = data_[i + 1]; } else { p2 = data_[i - 1]; double offset = p1.X - p2.X; p2.X = p1.X + offset; p2.Y = p1.Y; p3 = p2; } if (center_) { double offset = (p2.X - p1.X) / 2.0f; p1.X -= offset; p2.X -= offset; p3.X -= offset; } PointF xPos1 = xAxis.WorldToPhysical(p1.X, false); PointF yPos1 = yAxis.WorldToPhysical(p1.Y, false); PointF xPos2 = xAxis.WorldToPhysical(p2.X, false); PointF yPos2 = yAxis.WorldToPhysical(p2.Y, false); PointF xPos3 = xAxis.WorldToPhysical(p3.X, false); PointF yPos3 = yAxis.WorldToPhysical(p3.Y, false); g.DrawLine(p, xPos1.X, yPos1.Y, xPos2.X, yPos2.Y); g.DrawLine(p, xPos2.X, yPos2.Y, xPos3.X, yPos3.Y); } } }
public override void Draw(Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis) { base.Draw(g, xAxis, yAxis); Pen p; if (this.pen_ != null) { p = (System.Drawing.Pen) this.pen_; } else { p = new Pen(this.color_); } for (int i = 0; i < this.Data.Count; ++i) { PointD p1 = Data[i]; PointD p2; if (i + 1 != this.Data.Count) { p2 = Data[i + 1]; p2.Y = p1.Y; } else { p2 = Data[i - 1]; double offset = p1.X - p2.X; p2.X = p1.X + offset; p2.Y = p1.Y; } if (Center) { double offset = (p2.X - p1.X) / 2.0f; p1.X -= offset; p2.X -= offset; } PointF xPos1 = xAxis.WorldToPhysical(p1.X, false); PointF yPos1 = yAxis.WorldToPhysical(p1.Y, false); PointF xPos2 = xAxis.WorldToPhysical(p2.X, false); PointF yPos2 = yAxis.WorldToPhysical(p2.Y, false); g.DrawLine(p, xPos1.X, yPos1.Y, xPos1.X, yAxis.WorldToPhysical(0.0f, false).Y); g.DrawLine(p, xPos2.X, yPos2.Y, xPos2.X, yAxis.WorldToPhysical(0.0f, false).Y); } }
public void Draw(Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis) { int numberPoints = data_.Count; Pen p; if (this.pen_ != null) { p = (System.Drawing.Pen) this.pen_; } else { p = new Pen(this.color_); } // clipping is now handled assigning a clip region in the // graphic object before this call if (numberPoints == 1) { PointD point = data_[0]; PointF xPos = xAxis.WorldToPhysical(point.X, false); PointF yPos = yAxis.WorldToPhysical(point.Y, false); g.DrawLine(p, (float)(xPos.X - 0.5f), (float)yPos.Y, (float)xPos.X + 0.5f, (float)yPos.Y); } else { for (int i = 1; i < numberPoints; ++i) { if (!Double.IsNaN(data_[i - 1].X) && !Double.IsNaN(data_[i - 1].Y) && !Double.IsNaN(data_[i].X) && !Double.IsNaN(data_[i].Y)) { PointD point = data_[i - 1]; PointF x1 = xAxis.WorldToPhysical(point.X, false); PointF y1 = yAxis.WorldToPhysical(point.Y, false); point = data_[i]; PointF x2 = xAxis.WorldToPhysical(point.X, false); PointF y2 = yAxis.WorldToPhysical(point.Y, false); g.DrawLine(p, (float)x1.X, (float)y1.Y, (float)x2.X, (float)y2.Y); } } } }
public void Draw(Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis) { for (int i = 0; i < data_.Count; ++i) { // clipping is now handled assigning a clip region in the // graphic object before this call PointF xPos = xAxis.WorldToPhysical(data_[i].X, false); PointF yPos = yAxis.WorldToPhysical(data_[i].Y, false); marker_.Draw(g, (int)xPos.X, (int)yPos.Y); } }
private void DrawGridLines(Graphics g, PhysicalAxis axis, PhysicalAxis orthogonalAxis, System.Collections.ArrayList a, bool horizontal, Pen p) { for (int i = 0; i < a.Count; ++i) { PointF p1 = axis.WorldToPhysical((double)a[i], true); PointF p2 = p1; PointF p3 = orthogonalAxis.PhysicalMax; PointF p4 = orthogonalAxis.PhysicalMin; if (horizontal) { p1.Y = p4.Y; p2.Y = p3.Y; } else { p1.X = p4.X; p2.X = p3.X; } g.DrawLine(p, p1, p2); } }