Beispiel #1
0
        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);
        }
Beispiel #2
0
 /// <summary>
 /// Manually define Y axis tick labels
 /// </summary>
 public void YTicks(string[] labels) => YTicks(DataGen.Consecutive(labels.Length), labels);