Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void addLineErrorbars(Object[] params) throws JasymcaException
    internal virtual void addLineErrorbars(object[] @params)
    {
        if (!Hold_b)
        {
            reset();
        }
        if (@params.Length < 3)
        {
            throw new JasymcaException("At least 3 arguments required.");
        }
        PlotLine line = new PlotLine(this);

        double[] x = (double[])@params[0];
        line.lineMaxx = Math.Max(max(x), maxx);
        line.lineMinx = Math.Min(min(x), minx);
        double[] y = (double[])@params[1];
        line.lineMaxy = Math.Max(max(y), maxy);
        line.lineMiny = Math.Min(min(y), miny);
        if (x.Length != y.Length)
        {
            throw new JasymcaException("X and Y must be same length");
        }
        line.setPoints(x, y);
        double[] el = (double[])@params[2]; double[] eu = el;
        if (el.Length != y.Length)
        {
            throw new JasymcaException("Errors and Y must be same length");
        }
        int i = 3;

        if (@params.Length > 3 && !(@params[3] is string))
        {
            eu = (double[])@params[3];
            if (eu.Length != y.Length)
            {
                throw new JasymcaException("Errors and Y must be same length");
            }
            i++;
        }
        line.eu = eu;
        line.el = el;
        maxx    = Math.Max(line.lineMaxx, maxx);
        minx    = Math.Min(line.lineMinx, minx);
        maxy    = Math.Max(line.lineMaxy, maxy);
        miny    = Math.Min(line.lineMiny, miny);
        if (i < @params.Length && (@params[i] is string))
        {
            line.LineAttributes = @params[i].ToString();
            i++;
        }
        PlotLines.Add(line);
        setMinMax();
        repaint();
    }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void addLine(Object[] params) throws JasymcaException
    internal virtual void addLine(object[] @params)
    {
        if (!Hold_b)
        {
            reset();
        }
        for (int i = 0; i < @params.Length;)
        {
            PlotLine line = new PlotLine(this);
            if (i < @params.Length - 1 && !(@params[i + 1] is string))
            {
                double[] x = (double[])@params[i];
                if (plotmode == LOGLIN || plotmode == LOGLOG)
                {
                    log10(x);
                }
                line.lineMaxx = Math.Max(max(x), maxx);
                line.lineMinx = Math.Min(min(x), minx);
                double[] y = (double[])@params[i + 1];
                if (plotmode == LINLOG || plotmode == LOGLOG)
                {
                    log10(y);
                }
                line.lineMaxy = Math.Max(max(y), maxy);
                line.lineMiny = Math.Min(min(y), miny);
                if (x.Length != y.Length)
                {
                    throw new JasymcaException("X and Y must be same length");
                }
                line.setPoints(x, y);
                i += 2;
            }
            else
            {
                double[] x = (double[])@params[i];
                if (plotmode == LINLOG || plotmode == LOGLOG)
                {
                    log10(x);
                }
                maxx   = x.Length;
                minx   = 1;
                maxy   = max(x);
                miny   = min(x);
                line.x = new double[x.Length];
                for (int ind = 0; ind < x.Length; ind++)
                {
                    line.x[ind] = ind + 1;
                }
                line.setPoints(line.x, x);
                i++;
            }
            maxx = Math.Max(line.lineMaxx, maxx);
            minx = Math.Min(line.lineMinx, minx);
            maxy = Math.Max(line.lineMaxy, maxy);
            miny = Math.Min(line.lineMiny, miny);
            if (i < @params.Length && (@params[i] is string))
            {
                line.LineAttributes = @params[i].ToString();
                i++;
            }
            PlotLines.Add(line);
        }
        setMinMax();
        repaint();
    }