예제 #1
0
        // Find maximum value for bar graph including whiskers
        public static double GetMaxY(CurveList curveList, GraphPane g)
        {
            var maxY = double.MinValue;
            foreach (var curve in curveList)
            {
                if (curve is MeanErrorBarItem)
                {
                    for (var i = 0; i < curve.Points.Count; i++)
                    {
                        var point = curve.Points[i];
                        if (point.IsMissing)
                        {
                            continue;
                        }
                        if (!double.IsNaN(point.Y))
                        {
                            var errorTag = point.Tag as ErrorTag;
                            double whiskerMaxY;
                            if (null != errorTag)
                            {
                                whiskerMaxY = point.Y + errorTag.Error;
                            }
                            else
                            {
                                whiskerMaxY = point.Y;
                            }

                            maxY = Math.Max(maxY, whiskerMaxY);
                        }
                    }
                }

                double tMinX, tMinY, tMaxX, tMaxY;
                curveList.GetCurveRange(g, curve, out tMinX, out tMaxX, out tMinY, out tMaxY);

                maxY = Math.Max(maxY, tMaxY);
            }
            return maxY;
        }