/// <summary> /// Generate random values with a normal distribution /// </summary> public Population(Random rand, int pointCount, double mean = .5, double stdDev = .5) { values = DataGen.RandomNormal(rand, pointCount, mean, stdDev); Recalculate(); }
public PlottableBar(double[] xs, double[] ys, string label, double barWidth, double xOffset, bool fill, Color fillColor, double outlineWidth, Color outlineColor, double[] yErr, double errorLineWidth, double errorCapSize, Color errorColor, bool horizontal, bool showValues, Color valueColor, double[] yOffsets, Color negativeColor ) { if (ys is null || ys.Length == 0) { throw new ArgumentException("ys must contain data values"); } if (xs is null) { xs = DataGen.Consecutive(ys.Length); } if (xs.Length != ys.Length) { throw new ArgumentException("xs and ys must have same number of elements"); } if (yErr is null) { yErr = DataGen.Zeros(ys.Length); } if (yErr.Length != ys.Length) { throw new ArgumentException("yErr and ys must have same number of elements"); } if (yOffsets is null) { yOffsets = DataGen.Zeros(ys.Length); } this.xs = xs; this.ys = ys; this.yErr = yErr; this.xOffset = xOffset; this.label = label; this.verticalBars = !horizontal; this.showValues = showValues; this.barWidth = barWidth; this.errorCapSize = errorCapSize; this.fill = fill; this.fillColor = fillColor; this.negativeColor = negativeColor; this.yOffsets = yOffsets; fillBrush = new SolidBrush(fillColor); outlinePen = new Pen(outlineColor, (float)outlineWidth); errorPen = new Pen(errorColor, (float)errorLineWidth); valueTextFont = new Font(Fonts.GetDefaultFontName(), 12); valueTextBrush = new SolidBrush(valueColor); }