Esempio n. 1
0
        public bool AddBox(BoxSummaryData b, string tecnnique)
        {
            bool boxAdded = false;

            IEnumerable <BoxPlotPoint> points = b.Points;

            foreach (BoxPlotPoint p in points)
            {
                if (p.Min <= p.Q1 && p.Q1 <= p.Median && p.Median <= p.Q3 && p.Q3 <= p.Max)
                {
                    BoxData box = new BoxData(p.Min, p.Q1, p.Median, p.Q3, p.Max);
                    box.Name  = tecnnique;
                    box.Color = Chart.Colors[this.boxes.Count % Chart.Colors.Length];
                    this.boxes.Add(box);
                    boxAdded = true;
                    // check chart ranges
                    if (p.Min < this.chartStyle.Ymin)
                    {
                        this.chartStyle.Ymin = p.Min - 0.05;
                    }
                    if (p.Max > this.chartStyle.Ymax)
                    {
                        this.chartStyle.Ymax = p.Max + 0.05;
                    }
                    if (this.chartStyle.Ymin != -0.05d || this.chartStyle.Ymax != 1.05d)
                    {
                        this.chartStyle.YtickDelta = (this.chartStyle.Ymax - this.chartStyle.Ymin) / 10.0;
                    }
                }
                else
                {
                    throw new ComponentException(String.Format("Error in boxplot data.\nMin: {0}\nQ1: {1}\nMedian: {2}\nQ3: {3}\nMax: {4}",
                                                               p.Min, p.Q1, p.Median, p.Q3, p.Max
                                                               ));
                }
            }
            return(boxAdded);
        }
Esempio n. 2
0
        public bool AddBox(BoxSummaryData b, string tecnnique)
        {
            bool boxAdded = false;

            IEnumerable<BoxPlotPoint> points = b.Points;
            foreach (BoxPlotPoint p in points)
            {
                if (p.Min <= p.Q1 && p.Q1 <= p.Median && p.Median <= p.Q3 && p.Q3 <= p.Max)
                {
                    BoxData box = new BoxData(p.Min, p.Q1, p.Median, p.Q3, p.Max);
                    box.Name = tecnnique;
                    box.Color = Chart.Colors[this.boxes.Count % Chart.Colors.Length];
                    this.boxes.Add(box);
                    boxAdded = true;
                    // check chart ranges
                    if (p.Min < this.chartStyle.Ymin)
                    {
                        this.chartStyle.Ymin = p.Min - 0.05;
                    }
                    if (p.Max > this.chartStyle.Ymax)
                    {
                        this.chartStyle.Ymax = p.Max + 0.05;
                    }
                    if (this.chartStyle.Ymin != -0.05d || this.chartStyle.Ymax != 1.05d)
                    {
                        this.chartStyle.YtickDelta = (this.chartStyle.Ymax - this.chartStyle.Ymin) / 10.0;
                    }
                }
                else
                {
                    throw new ComponentException(String.Format("Error in boxplot data.\nMin: {0}\nQ1: {1}\nMedian: {2}\nQ3: {3}\nMax: {4}",
                        p.Min, p.Q1, p.Median, p.Q3, p.Max
                    ));
                }
            }
            return boxAdded;
        }