public PlottableAxLine(double position, bool vertical, Color color, double lineWidth, string label, bool draggable, double dragLimitLower, double dragLimitUpper, LineStyle lineStyle) { this.position = position; this.vertical = vertical; this.color = color; this.label = label; this.lineStyle = lineStyle; pointCount = 1; pen = new Pen(color, (float)lineWidth) { StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round, DashStyle = StyleTools.DashStyle(lineStyle), DashPattern = StyleTools.DashPattern(lineStyle) }; DragEnable(draggable); if (vertical) { DragLimit(x1: dragLimitLower, x2: dragLimitUpper, y1: double.NegativeInfinity, y2: double.PositiveInfinity); } else { DragLimit(x1: double.NegativeInfinity, x2: double.PositiveInfinity, y1: dragLimitLower, y2: dragLimitUpper); } }
public PlottableErrorBars(double[] xs, double[] ys, double[] xPositiveError, double[] xNegativeError, double[] yPositiveError, double[] yNegativeError, Color color, double lineWidth, double capSize, string label) { //check input if (xs.Length != ys.Length) { throw new ArgumentException("X and Y arrays must have the same length"); } //save properties this.xs = xs; this.ys = ys; this.xPositiveError = SanitizeErrors(xPositiveError, xs.Length); this.xNegativeError = SanitizeErrors(xNegativeError, xs.Length); this.yPositiveError = SanitizeErrors(yPositiveError, xs.Length); this.yNegativeError = SanitizeErrors(yNegativeError, xs.Length); this.capSize = (float)capSize; this.color = color; this.label = label; pointCount = xs.Length; penLine = new Pen(this.color, (float)lineWidth) { StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round, DashStyle = StyleTools.DashStyle(lineStyle), DashPattern = StyleTools.DashPattern(lineStyle) }; }
public PlottableScatter(double[] xs, double[] ys, Color color, double lineWidth, double markerSize, string label, double[] errorX, double[] errorY, double errorLineWidth, double errorCapSize, bool stepDisplay, MarkerShape markerShape, LineStyle lineStyle) { if ((xs == null) || (ys == null)) { throw new Exception("X and Y data cannot be null"); } if (xs.Length != ys.Length) { throw new Exception("Xs and Ys must have same length"); } if (errorY != null) { for (int i = 0; i < errorY.Length; i++) { if (errorY[i] < 0) { errorY[i] = -errorY[i]; } } } if (errorX != null) { for (int i = 0; i < errorX.Length; i++) { if (errorX[i] < 0) { errorX[i] = -errorX[i]; } } } this.xs = xs; this.ys = ys; this.color = color; this.lineWidth = lineWidth; this.markerSize = (float)markerSize; this.label = label; this.errorX = errorX; this.errorY = errorY; this.errorLineWidth = (float)errorLineWidth; this.errorCapSize = (float)errorCapSize; this.stepDisplay = stepDisplay; this.markerShape = markerShape; this.lineStyle = lineStyle; pointCount = xs.Length; if (xs.Length != ys.Length) { throw new ArgumentException("X and Y arrays must have the same length"); } if ((errorX != null) && (xs.Length != errorX.Length)) { throw new ArgumentException("errorX must be the same length as the original data"); } if ((errorY != null) && (xs.Length != errorY.Length)) { throw new ArgumentException("errorY must be the same length as the original data"); } penLine = new Pen(color, (float)lineWidth) { StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round, DashStyle = StyleTools.DashStyle(lineStyle), DashPattern = StyleTools.DashPattern(lineStyle) }; penLineError = new Pen(color, (float)errorLineWidth) { StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round }; brush = new SolidBrush(color); }