Example #1
0
        public override AxisLimits2D GetLimits()
        {
            var limits = new AxisLimits2D();

            foreach (var box in boxAndWhiskers)
            {
                limits.ExpandX(box.xPosition - box.box.width / 2, box.xPosition + box.box.width / 2);
                limits.ExpandX(box.xPosition - box.whisker.width / 2, box.xPosition + box.whisker.width / 2);
                limits.ExpandX(box.xPosition - box.midline.width / 2, box.xPosition + box.midline.width / 2);
                limits.ExpandY(box.box.min, box.box.max);
                limits.ExpandY(box.whisker.min, box.whisker.max);
                limits.ExpandY(box.midline.position, box.midline.position);

                if (box.points.Count() > 0) //Cannot call Min() or Max() on empty list
                {
                    limits.ExpandY(box.points.Min(), box.points.Max());
                }
            }
            return(limits);
        }
        public override AxisLimits2D GetLimits()
        {
            var limits = new AxisLimits2D();

            foreach (var box in boxAndWhiskers)
            {
                double pointSpread = (Math.Abs(box.dataPoints.offsetFraction) + box.dataPoints.spreadFraction) * box.box.width / 2;
                limits.ExpandX(box.xPosition - pointSpread, box.xPosition + pointSpread);
                limits.ExpandX(box.xPosition - box.box.width / 2, box.xPosition + box.box.width / 2);
                limits.ExpandX(box.xPosition - box.whisker.width / 2, box.xPosition + box.whisker.width / 2);
                limits.ExpandX(box.xPosition - box.midline.width / 2, box.xPosition + box.midline.width / 2);
                limits.ExpandY(box.box.min, box.box.max);
                limits.ExpandY(box.whisker.min, box.whisker.max);
                limits.ExpandY(box.midline.position, box.midline.position);

                if (box.dataPoints.values.Count() > 0) //Cannot call Min() or Max() on empty list
                {
                    limits.ExpandY(box.dataPoints.values.Min(), box.dataPoints.values.Max());
                }
            }
            return(limits);
        }