示例#1
0
        public static void DesignerModeDemoPlot(Plot plt)
        {
            int    pointCount   = 101;
            double pointSpacing = .01;

            double[] dataXs  = DataGen.Consecutive(pointCount, pointSpacing);
            double[] dataSin = DataGen.Sin(pointCount);
            double[] dataCos = DataGen.Cos(pointCount);

            plt.PlotScatter(dataXs, dataSin);
            plt.PlotScatter(dataXs, dataCos);
            plt.AxisAuto(0);
            plt.Title("ScottPlot User Control");
            plt.YLabel("Sample Data");
        }
        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);
        }