Ejemplo n.º 1
0
        private void setFromObject(object[] x, double?[] y, ObjectToDoubleConverter converter)
        {
            if (x.Length != y.Length)
            {
                throw new ArgumentException("y array must have same length as x array", "y");
            }

            this.x = new double[x.Length];
            this.y = new double?[x.Length];

            minY_gt_zero = minY = maxY = null;
            minX_gt_zero = minX = maxX = null;

            for (int i = 0; i < x.Length; i++)
            {
                double xv = converter(x[i]);
                double?yv = y[i];
                this.x[i] = xv;
                this.y[i] = yv;

                if (xv > 0 && (minX_gt_zero == null || xv < minX_gt_zero.Value))
                {
                    minX_gt_zero = xv;
                }
                if (minX == null || xv < minX.Value)
                {
                    minX = xv;
                }
                if (maxX == null || xv > maxX.Value)
                {
                    maxX = xv;
                }

                if (yv > 0 && (minY_gt_zero == null || yv < minY_gt_zero.Value))
                {
                    minY_gt_zero = yv;
                }
                if (minY == null || yv < minY.Value)
                {
                    minY = yv;
                }
                if (maxY == null || yv > maxY.Value)
                {
                    maxY = yv;
                }
            }

            raiseEvent();
        }
Ejemplo n.º 2
0
        private void setFromObject(object[] x, IList <double?>[] y, ObjectToDoubleConverter converter)
        {
            foreach (List <double?> yv in y)
            {
                if (x.Length != yv.Count)
                {
                    throw new ArgumentException("y array must have same length as x array", "y");
                }
            }

            this.x = new double[x.Length];
            this.y = new double?[x.Length][];
            for (int i = 0; i < x.Length; i++)
            {
                this.y[i] = new double?[y.Length];
            }

            minX_gt_zero = minX = maxX = null;

            for (int i = 0; i < x.Length; i++)
            {
                double xv = converter(x[i]);
                this.x[i] = xv;

                if (xv > 0 && (minX_gt_zero == null || xv < minX_gt_zero.Value))
                {
                    minX_gt_zero = xv;
                }
                if (minX == null || xv < minX.Value)
                {
                    minX = xv;
                }
                if (maxX == null || xv > maxX.Value)
                {
                    maxX = xv;
                }

                for (int j = 0; j < y.Length; j++)
                {
                    this.y[i][j] = y[j][i];
                }
            }

            raiseEvent();
        }