public PlottableScatter PlotScatter( double[] xs, double[] ys, Color?color = null, double lineWidth = 1, double markerSize = 5, string label = null, double[] errorX = null, double[] errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { var scatterPlot = new PlottableScatter(xs, ys, errorX, errorY) { color = color ?? settings.GetNextColor(), lineWidth = lineWidth, markerSize = (float)markerSize, label = label, errorLineWidth = (float)errorLineWidth, errorCapSize = (float)errorCapSize, stepDisplay = false, markerShape = markerShape, lineStyle = lineStyle }; Add(scatterPlot); return(scatterPlot); }
public static Geometry MarkerShapeToGeometry(MarkerShape markerShape, double size) { switch (markerShape) { case MarkerShape.None: return(null); case MarkerShape.Circle: return(new EllipseGeometry(new Point(0, 0), size, size)); case MarkerShape.Triangle: return(new PathGeometry(new PathFigure[] { s_triFigure }, FillRule.Nonzero, new ScaleTransform(size, size))); case MarkerShape.Square: double h = size / 1.2; return(new RectangleGeometry(new Rect(-h, -h, h * 2, h * 2))); case MarkerShape.Diamond: return(new PathGeometry(new PathFigure[] { s_diaFigure }, FillRule.Nonzero, new ScaleTransform(size, size))); case MarkerShape.Star: return(new PathGeometry(new PathFigure[] { s_starFigure }, FillRule.Nonzero, new ScaleTransform(size, size))); default: System.Diagnostics.Debug.Assert(false, "unknown mark shape"); goto case MarkerShape.Circle; } }
public PlottableThing( Color?lineColor = null, float lineWidth = 1, LineStyle lineStyle = LineStyle.solid, Color?markerColor = null, float markerSize = 3, MarkerShape markerShape = MarkerShape.circleSolid, double alpha = 1, string label = null ) { // choose default colors based on color sequence for theme if (lineColor == null) { lineColor = Color.Red; } markerColor = lineColor; // for now // adjust colors based on alpha this.lineColor = (Color)lineColor; this.lineWidth = lineWidth; this.lineStyle = lineStyle; this.markerColor = (Color)markerColor; this.markerSize = markerSize; this.markerShape = markerShape; this.label = label; }
public MarkerStyle(float size = 5, Color?color = null, bool antiAlias = true, MarkerShape markerShape = MarkerShape.circle) { this.size = size; this.color = color ?? Color.Magenta; this.antiAlias = antiAlias; this.markerShape = markerShape; }
public FunctionPlot PlotFunction( Func <double, double?> function, Color?color = null, double lineWidth = 1, double markerSize = 0, string label = "f(x)", MarkerShape markerShape = MarkerShape.none, LineStyle lineStyle = LineStyle.Solid ) { if (markerShape != MarkerShape.none || markerSize != 0) { throw new ArgumentException("function plots do not use markers"); } FunctionPlot functionPlot = new FunctionPlot(function) { Color = color ?? settings.GetNextColor(), LineWidth = lineWidth, LineStyle = lineStyle, Label = label }; Add(functionPlot); return(functionPlot); }
public PlottableFunction(Func <double, double?> function, Color color, double lineWidth, double markerSize, string label, MarkerShape markerShape, LineStyle lineStyle) { this.function = function; this.color = color; this.lineWidth = lineWidth; this.markerSize = markerSize; this.label = label; this.markerShape = markerShape; this.lineStyle = lineStyle; }
public LegendItem(string label, Color colour, LineStyle lineStyle = LineStyle.Solid, double lineWidth = 1, MarkerShape markerShape = MarkerShape.filledCircle, double markerSize = 3) { this.label = label; this.colour = colour; this.lineStyle = lineStyle; this.lineWidth = lineWidth; this.markerShape = markerShape; this.markerSize = markerSize; }
public PlottableScatterHighlight PlotScatterHighlight( double[] xs, double[] ys, Color?color = null, double lineWidth = 1, double markerSize = 5, string label = null, double[] errorX = null, double[] errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid, MarkerShape highlightedShape = MarkerShape.openCircle, Color?highlightedColor = null, double?highlightedMarkerSize = null ) { if (color is null) { color = settings.GetNextColor(); } if (highlightedColor is null) { highlightedColor = Color.Red; } if (highlightedMarkerSize is null) { highlightedMarkerSize = 2 * markerSize; } PlottableScatterHighlight scatterPlot = new PlottableScatterHighlight( xs: xs, ys: ys, color: (Color)color, lineWidth: lineWidth, markerSize: markerSize, label: label, errorX: errorX, errorY: errorY, errorLineWidth: errorLineWidth, errorCapSize: errorCapSize, stepDisplay: false, markerShape: markerShape, lineStyle: lineStyle, highlightedShape: highlightedShape, highlightedColor: highlightedColor.Value, highlightedMarkerSize: highlightedMarkerSize.Value ); Add(scatterPlot); return(scatterPlot); }
public static void DrawMarker(Graphics gfx, PointF pixelLocation, MarkerShape shape, float size, Brush brush, Pen pen) { if (size == 0 || shape == MarkerShape.none) { return; } IMarker marker = Marker.Create(shape); DrawMarker(gfx, pixelLocation, marker, size, brush, pen); }
public PlottableScatterHighlight PlotScatterHighlight( double[] xs, double[] ys, Color?color = null, double lineWidth = 1, double markerSize = 5, string label = null, double[] errorX = null, double[] errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid, MarkerShape highlightedShape = MarkerShape.openCircle, Color?highlightedColor = null, double?highlightedMarkerSize = null ) { if (color is null) { color = settings.GetNextColor(); } if (highlightedColor is null) { highlightedColor = Color.Red; } if (highlightedMarkerSize is null) { highlightedMarkerSize = 2 * markerSize; } var scatterPlot = new PlottableScatterHighlight(xs, ys, errorX, errorY) { color = (Color)color, lineWidth = lineWidth, markerSize = (float)markerSize, label = label, errorLineWidth = (float)errorLineWidth, errorCapSize = (float)errorCapSize, stepDisplay = false, markerShape = markerShape, lineStyle = lineStyle, highlightedShape = highlightedShape, highlightedColor = highlightedColor.Value, highlightedMarkerSize = (float)highlightedMarkerSize.Value }; Add(scatterPlot); return(scatterPlot); }
public PlottableScatterHighlight(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, MarkerShape highlightedShape, Color highlightedColor, double highlightedMarkerSize) : base(xs, ys, color, lineWidth, markerSize, label, errorX, errorY, errorLineWidth, errorCapSize, stepDisplay, markerShape, lineStyle) { if (xs.Length != ys.Length) { throw new ArgumentException("xs and ys must have same length"); } this.highlightedColor = highlightedColor; this.highlightedMarkerSize = (float)highlightedMarkerSize; this.highlightedShape = highlightedShape; HighlightClear(); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); string[] markerShapeNames = Enum.GetNames(typeof(MarkerShape)); for (int i = 0; i < markerShapeNames.Length; i++) { string markerShapeName = markerShapeNames[i]; MarkerShape markerShape = (MarkerShape)Enum.Parse(typeof(MarkerShape), markerShapeName); double[] sin = DataGen.Sin(pointCount, 2, -i); plt.PlotScatter(x, sin, label: markerShapeName, markerShape: markerShape, markerSize: 7); } plt.Grid(false); plt.Legend(fontSize: 10); }
public PlottableBoxAndWhiskerV2(double[] xs, double[][] ys, Color color, string label, MarkerShape markerShape, double lineWidth, double boxWidth) { if (xs == null || ys == null) { throw new Exception("Y data cannot be null"); } if (xs.Length != ys.Length) { throw new ArgumentException("X positions must be the same length as Y values"); } yLimits = new double[2]; yLimits[0] = ys[0][0]; yLimits[1] = ys[0][0]; for (int i = 0; i < ys.Length; i++) { for (int j = 0; j < ys[i].Length; j++) { if (ys[i][j] < yLimits[0]) { yLimits[0] = ys[i][j]; } else if (ys[i][j] > yLimits[1]) { yLimits[1] = ys[i][j]; } } } this.xs = xs; this.ys = ys; this.color = color; this.label = label; this.lineWidth = lineWidth; this.boxWidth = boxWidth; this.markerShape = markerShape; pen = new Pen(color, (float)lineWidth); brush = new SolidBrush(color); }
public PlottableFunction PlotFunction( Func <double, double?> function, Color?color = null, double lineWidth = 1, double markerSize = 0, string label = "f(x)", MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { if (color == null) { color = settings.GetNextColor(); } PlottableFunction functionPlot = new PlottableFunction(function, color.Value, lineWidth, markerSize, label, markerShape, lineStyle); Add(functionPlot); return(functionPlot); }
public PlottableScatter PlotPoint( double x, double y, Color?color = null, double markerSize = 5, string label = null, double?errorX = null, double?errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { if (color == null) { color = settings.GetNextColor(); } double[] errorXarray = (errorX != null) ? new double[] { (double)errorX } : null; double[] errorYarray = (errorY != null) ? new double[] { (double)errorY } : null; PlottableScatter scatterPlot = new PlottableScatter( xs: new double[] { x }, ys: new double[] { y }, color: (Color)color, lineWidth: 0, markerSize: markerSize, label: label, errorX: errorXarray, errorY: errorYarray, errorLineWidth: errorLineWidth, errorCapSize: errorCapSize, stepDisplay: false, markerShape: markerShape, lineStyle: lineStyle ); settings.plottables.Add(scatterPlot); return(scatterPlot); }
public PlottableScatter PlotPoint( double x, double y, Color?color = null, double markerSize = 5, string label = null, double?errorX = null, double?errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { if (color == null) { color = settings.GetNextColor(); } var scatterPlot = new PlottableScatter( xs: new double[] { x }, ys: new double[] { y }, errorX: (errorX is null) ? null : new double[] { (double)errorX }, errorY: (errorY is null) ? null : new double[] { (double)errorY } ) { color = (Color)color, lineWidth = 0, markerSize = (float)markerSize, label = label, errorLineWidth = (float)errorLineWidth, errorCapSize = (float)errorCapSize, stepDisplay = false, markerShape = markerShape, lineStyle = lineStyle }; Add(scatterPlot); return(scatterPlot); }
public PlottableScatter PlotScatter( double[] xs, double[] ys, Color?color = null, double lineWidth = 1, double markerSize = 5, string label = null, double[] errorX = null, double[] errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { if (color == null) { color = settings.GetNextColor(); } PlottableScatter scatterPlot = new PlottableScatter( xs: xs, ys: ys, color: (Color)color, lineWidth: lineWidth, markerSize: markerSize, label: label, errorX: errorX, errorY: errorY, errorLineWidth: errorLineWidth, errorCapSize: errorCapSize, stepDisplay: false, markerShape: markerShape, lineStyle: lineStyle ); settings.plottables.Add(scatterPlot); return(scatterPlot); }
public static void DrawMarker(Graphics gfx, PointF pixelLocation, MarkerShape shape, float size, Brush brush, Pen pen) { if (size == 0 || shape == MarkerShape.none) { return; } float diameter = size; float radius = diameter / 2; /* Improve marker vs. line alignment on Linux and MacOS * https://github.com/ScottPlot/ScottPlot/issues/340 * https://github.com/ScottPlot/ScottPlot/pull/1660 */ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { pixelLocation = new PointF(pixelLocation.X + .5f, pixelLocation.Y); } IMarker marker = Marker.Create(shape); marker.Draw(gfx, pixelLocation, radius, brush, pen); }
/// <summary> /// Adds a point. /// </summary> /// <param name="layerKey"></param> /// <param name="longitude"></param> /// <param name="latitude"></param> /// <param name="caption"></param> /// <param name="font"></param> /// <param name="markShape"></param> /// <param name="size"></param> /// <param name="stroke"></param> /// <param name="fill"></param> public void DrawPoint(string layerKey, double longitude, double latitude, string caption, System.Drawing.Font font, System.Drawing.Color textColor, MarkerShape markShape, double size, System.Drawing.Color stroke, System.Drawing.Color fill) { #if !DYN var mark = new C1.WPF.Maps.C1VectorPlacemark(); mark.Lod = new C1.WPF.Maps.LOD(1, 300, 0, 10); // tbd: allow to control this #else dynamic mark = DynLoader.CreateC1MapsInstance("C1VectorPlacemark"); mark.Lod = DynLoader.CreateC1MapsInstance("C1.WPF.Maps.LOD", 1, 300, 0, 10); #endif mark.GeoPoint = new Point(longitude, latitude); if (!string.IsNullOrEmpty(caption)) { mark.Label = caption; Util.ApplyFontToControl(font, mark); if (!Util.IsColorEmpty(textColor)) { mark.Foreground = Util.BrushFromGdiColor(textColor); } // mark.LabelPosition = WPF.Maps.LabelPosition.Right | WPF.Maps.LabelPosition.Bottom; // mark.Background = new SolidColorBrush(Colors.Red); // TBD: label: // - setting mark.LabelPosition makes the label tiny. clarify. } mark.Geometry = Util.MarkerShapeToGeometry(markShape, size); mark.Stroke = Util.BrushFromGdiColor(stroke); mark.Fill = Util.BrushFromGdiColor(fill); PointsMapsLayer ml = _layers.Find((l) => l.MapLayer.Key == layerKey) as PointsMapsLayer; System.Diagnostics.Debug.Assert(ml != null); ml.AddMark(mark); }
public static void DrawMarker(Graphics gfx, PointF pixelLocation, MarkerShape shape, float size, Color color) { Pen pen = new Pen(color); Brush brush = new SolidBrush(color); PointF corner1 = new PointF(pixelLocation.X - size / 2, pixelLocation.Y - size / 2); PointF corner2 = new PointF(pixelLocation.X + size / 2, pixelLocation.Y + size / 2); SizeF bounds = new SizeF(size, size); RectangleF rect = new RectangleF(corner1, bounds); switch (shape) { case MarkerShape.filledCircle: gfx.FillEllipse(brush, rect); break; case MarkerShape.openCircle: gfx.DrawEllipse(pen, rect); break; case MarkerShape.filledSquare: gfx.FillRectangle(brush, rect); break; case MarkerShape.openSquare: gfx.DrawRectangle(pen, corner1.X, corner1.Y, size, size); break; case MarkerShape.filledDiamond: // Create points that define polygon. PointF point1 = new PointF(pixelLocation.X, pixelLocation.Y + size / 2); PointF point2 = new PointF(pixelLocation.X - size / 2, pixelLocation.Y); PointF point3 = new PointF(pixelLocation.X, pixelLocation.Y - size / 2); PointF point4 = new PointF(pixelLocation.X + size / 2, pixelLocation.Y); PointF[] curvePoints = { point1, point2, point3, point4 }; //Draw polygon to screen gfx.FillPolygon(brush, curvePoints); break; case MarkerShape.openDiamond: // Create points that define polygon. PointF point5 = new PointF(pixelLocation.X, pixelLocation.Y + size / 2); PointF point6 = new PointF(pixelLocation.X - size / 2, pixelLocation.Y); PointF point7 = new PointF(pixelLocation.X, pixelLocation.Y - size / 2); PointF point8 = new PointF(pixelLocation.X + size / 2, pixelLocation.Y); PointF[] curvePoints2 = { point5, point6, point7, point8 }; //Draw polygon to screen gfx.DrawPolygon(pen, curvePoints2); break; case MarkerShape.asterisk: Font drawFont = new Font("CourierNew", size * 3); SizeF textSize = Drawing.GDI.MeasureString(gfx, "*", drawFont); PointF asteriskPoint = new PointF(pixelLocation.X - textSize.Width / 2, pixelLocation.Y - textSize.Height / 4); gfx.DrawString("*", drawFont, brush, asteriskPoint); break; case MarkerShape.hashTag: Font drawFont2 = new Font("CourierNew", size * 2); SizeF textSize2 = Drawing.GDI.MeasureString(gfx, "#", drawFont2); PointF asteriskPoint2 = new PointF(pixelLocation.X - textSize2.Width / 2, pixelLocation.Y - textSize2.Height / 3); gfx.DrawString("#", drawFont2, brush, asteriskPoint2); break; case MarkerShape.cross: Font drawFont3 = new Font("CourierNew", size * 2); SizeF textSize3 = Drawing.GDI.MeasureString(gfx, "+", drawFont3); PointF asteriskPoint3 = new PointF(pixelLocation.X - textSize3.Width / (5 / 2), pixelLocation.Y - textSize3.Height / 2); gfx.DrawString("+", drawFont3, brush, asteriskPoint3); break; case MarkerShape.eks: Font drawFont4 = new Font("CourierNew", size * 2); SizeF textSize4 = Drawing.GDI.MeasureString(gfx, "x", drawFont4); PointF asteriskPoint4 = new PointF(pixelLocation.X - textSize4.Width / (5 / 2), pixelLocation.Y - textSize4.Height / 2); gfx.DrawString("x", drawFont4, brush, asteriskPoint4); break; case MarkerShape.verticalBar: Font drawFont5 = new Font("CourierNew", size * 2); SizeF textSize5 = Drawing.GDI.MeasureString(gfx, "|", drawFont5); PointF asteriskPoint5 = new PointF(pixelLocation.X - textSize5.Width / (5 / 2), pixelLocation.Y - textSize5.Height / 2); gfx.DrawString("|", drawFont5, brush, asteriskPoint5); break; case MarkerShape.triUp: // Create points that define polygon. PointF point9 = new PointF(pixelLocation.X, pixelLocation.Y - size); PointF point10 = new PointF(pixelLocation.X, pixelLocation.Y); PointF point11 = new PointF(pixelLocation.X - size * (float)0.866, pixelLocation.Y + size * (float)0.5); PointF point12 = new PointF(pixelLocation.X, pixelLocation.Y); PointF point13 = new PointF(pixelLocation.X + size * (float)0.866, (pixelLocation.Y + size * (float)0.5)); PointF[] curvePoints3 = { point12, point9, point10, point11, point12, point13 }; //Draw polygon to screen gfx.DrawPolygon(pen, curvePoints3); break; case MarkerShape.triDown: // Create points that define polygon. PointF point14 = new PointF(pixelLocation.X, pixelLocation.Y + size); PointF point15 = new PointF(pixelLocation.X, pixelLocation.Y); PointF point16 = new PointF(pixelLocation.X - size * (float)0.866, pixelLocation.Y - size * (float)0.5); PointF point17 = new PointF(pixelLocation.X, pixelLocation.Y); PointF point18 = new PointF(pixelLocation.X + size * (float)0.866, (pixelLocation.Y - size * (float)0.5)); PointF[] curvePoints4 = { point17, point14, point15, point16, point17, point18 }; //Draw polygon to screen gfx.DrawPolygon(pen, curvePoints4); break; default: throw new NotImplementedException($"unsupported marker type: {shape}"); } }
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 ArgumentException("X and Y data cannot be null"); } if ((xs.Length == 0) || (ys.Length == 0)) { throw new ArgumentException("xs and ys must have at least one element"); } if (xs.Length != ys.Length) { throw new ArgumentException("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; 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 = GDI.Pen(color, lineWidth, lineStyle, true); penLineError = GDI.Pen(color, errorLineWidth, LineStyle.Solid, true); }
public ScatterPlot PlotPoint(double x, double y, Color?color = null, double markerSize = 5, string label = null, double?errorX = null, double?errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid) => throw new NotImplementedException();
public static void DrawMarkers(Graphics gfx, ICollection <PointF> pixelLocations, MarkerShape shape, float size, Color color, float linewidth = 1) { using SolidBrush brush = new(color); using Pen pen = new(color, linewidth); IMarker marker = Marker.Create(shape); foreach (PointF pt in pixelLocations) { DrawMarker(gfx, pt, marker, size, brush, pen); } }
public static void DrawMarker(Graphics gfx, PointF pixelLocation, MarkerShape shape, float size, Color color, float linewidth = 1) { using Brush brush = new SolidBrush(color); using Pen pen = new(color, linewidth); DrawMarker(gfx, pixelLocation, shape, size, brush, pen); }
public static extern void player_pluginmark_selectShape(IntPtr marker, MarkerShape shape);
/// <summary> /// 通知组件选择一个形状 /// </summary> /// <param name="shp">目标形状</param> public void selectShape(MarkerShape shp) { wizMarkerNative.player_pluginmark_selectShape(ptr, shp); }
public PlottableBoxAndWhiskerV2 PlotBoxAndWhiskerV2(double[] xs, double[][] ys, MarkerShape markerShape = MarkerShape.asterisk, double lineWidth = 2, Color?color = null, string label = null, double boxWidth = 50) { if (!color.HasValue) { color = settings.GetNextColor(); } PlottableBoxAndWhiskerV2 boxWhisker = new PlottableBoxAndWhiskerV2(xs, ys, color.Value, label, markerShape, lineWidth, boxWidth); settings.plottables.Add(boxWhisker); return(boxWhisker); }
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) { // this prevents sharp corners StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round }; switch (lineStyle) { case LineStyle.Solid: penLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; break; case LineStyle.Dash: penLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; penLine.DashPattern = new float[] { 8.0F, 4.0F }; break; case LineStyle.DashDot: penLine.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; penLine.DashPattern = new float[] { 8.0F, 4.0F, 2.0F, 4.0F }; break; case LineStyle.DashDotDot: penLine.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; penLine.DashPattern = new float[] { 8.0F, 4.0F, 2.0F, 4.0F, 2.0F, 4.0F }; break; case LineStyle.Dot: penLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; penLine.DashPattern = new float[] { 2.0F, 4.0F }; break; } penLineError = new Pen(color, (float)errorLineWidth) { // this prevents sharp corners StartCap = System.Drawing.Drawing2D.LineCap.Round, EndCap = System.Drawing.Drawing2D.LineCap.Round, LineJoin = System.Drawing.Drawing2D.LineJoin.Round }; brush = new SolidBrush(color); }
public PlottableScatterHighlightTestable(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, MarkerShape highlightedShape, Color highlightedColor, double highlightedMarkerSize) : base(xs, ys, color, lineWidth, markerSize, label, errorX, errorY, errorLineWidth, errorCapSize, stepDisplay, markerShape, lineStyle, highlightedShape, highlightedColor, highlightedMarkerSize) { }
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; 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, 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 }; }