예제 #1
0
 public void Remove(AxisScaleSegment segment)
 {
     if (segment != null)
     {
         base.List.Remove(segment);
     }
 }
        public RectangleF GetBreakLinePosition(ChartGraphics graph, AxisScaleSegment nextSegment)
        {
            RectangleF rectangleF      = this.axis.PlotAreaPosition.ToRectangleF();
            double     linearPosition  = this.axis.GetLinearPosition(nextSegment.ScaleMinimum);
            double     linearPosition2 = this.axis.GetLinearPosition(this.ScaleMaximum);

            if (this.axis.AxisPosition == AxisPosition.Right || this.axis.AxisPosition == AxisPosition.Left)
            {
                rectangleF.Y      = (float)Math.Min(linearPosition, linearPosition2);
                rectangleF.Height = (float)Math.Max(linearPosition, linearPosition2);
            }
            else
            {
                rectangleF.X     = (float)Math.Min(linearPosition, linearPosition2);
                rectangleF.Width = (float)Math.Max(linearPosition, linearPosition2);
            }
            rectangleF = Rectangle.Round(graph.GetAbsoluteRectangle(rectangleF));
            if (this.axis.AxisPosition == AxisPosition.Right || this.axis.AxisPosition == AxisPosition.Left)
            {
                rectangleF.Height = Math.Abs(rectangleF.Y - rectangleF.Height);
                rectangleF.X     -= (float)this.axis.chartArea.BorderWidth;
                rectangleF.Width += (float)(2 * this.axis.chartArea.BorderWidth);
            }
            else
            {
                rectangleF.Width   = Math.Abs(rectangleF.X - rectangleF.Width);
                rectangleF.Y      -= (float)this.axis.chartArea.BorderWidth;
                rectangleF.Height += (float)(2 * this.axis.chartArea.BorderWidth);
            }
            return(rectangleF);
        }
 public void GetAxisSegmentForScaleBreaks(AxisScaleSegmentCollection axisSegments)
 {
     axisSegments.Clear();
     if (this.IsEnabled())
     {
         this.FillAxisSegmentCollection(axisSegments);
         if (axisSegments.Count >= 1)
         {
             int startScaleFromZeroSegmentIndex = this.GetStartScaleFromZeroSegmentIndex(axisSegments);
             int num = 0;
             foreach (AxisScaleSegment axisSegment in axisSegments)
             {
                 bool   shouldStartFromZero = (byte)((num == startScaleFromZeroSegmentIndex) ? 1 : 0) != 0;
                 double scaleMinimum        = axisSegment.ScaleMinimum;
                 double scaleMaximum        = axisSegment.ScaleMaximum;
                 axisSegment.Interval     = this.axis.EstimateNumberAxis(ref scaleMinimum, ref scaleMaximum, shouldStartFromZero, this.axis.prefferedNumberofIntervals, this.axis.Crossing, true, true);
                 axisSegment.ScaleMinimum = scaleMinimum;
                 axisSegment.ScaleMaximum = scaleMaximum;
                 if (axisSegment.ScaleMinimum < this.axis.Minimum)
                 {
                     axisSegment.ScaleMinimum = this.axis.Minimum;
                 }
                 if (axisSegment.ScaleMaximum > this.axis.Maximum)
                 {
                     axisSegment.ScaleMaximum = this.axis.Maximum;
                 }
                 num++;
             }
             bool             flag = false;
             AxisScaleSegment axisScaleSegment2 = axisSegments[0];
             for (int i = 1; i < axisSegments.Count; i++)
             {
                 AxisScaleSegment axisScaleSegment3 = axisSegments[i];
                 if (axisScaleSegment3.ScaleMinimum <= axisScaleSegment2.ScaleMaximum)
                 {
                     if (axisScaleSegment3.ScaleMaximum > axisScaleSegment2.ScaleMaximum)
                     {
                         axisScaleSegment2.ScaleMaximum = axisScaleSegment3.ScaleMaximum;
                     }
                     flag = true;
                     axisSegments.RemoveAt(i);
                     i--;
                 }
                 else
                 {
                     axisScaleSegment2 = axisScaleSegment3;
                 }
             }
             if (flag)
             {
                 this.SetAxisSegmentPosition(axisSegments);
             }
         }
     }
 }
예제 #4
0
 public void EnforceSegment(AxisScaleSegment segment)
 {
     this.enforcedSegment = segment;
 }
예제 #5
0
 public void Insert(int index, AxisScaleSegment value)
 {
     base.List.Insert(index, value);
 }
예제 #6
0
 public int IndexOf(AxisScaleSegment value)
 {
     return(base.List.IndexOf(value));
 }
예제 #7
0
 public bool Contains(AxisScaleSegment value)
 {
     return(base.List.Contains(value));
 }
예제 #8
0
 public int Add(AxisScaleSegment segment)
 {
     return(base.List.Add(segment));
 }
        public void PaintBreakLine(ChartGraphics graph, AxisScaleSegment nextSegment)
        {
            RectangleF   breakLinePosition = this.GetBreakLinePosition(graph, nextSegment);
            GraphicsPath breakLinePath     = this.GetBreakLinePath(breakLinePosition, true);
            GraphicsPath graphicsPath      = null;

            if (breakLinePosition.Width > 0.0 && breakLinePosition.Height > 0.0)
            {
                graphicsPath = this.GetBreakLinePath(breakLinePosition, false);
                using (GraphicsPath graphicsPath2 = new GraphicsPath())
                {
                    graphicsPath2.AddPath(breakLinePath, true);
                    graphicsPath2.Reverse();
                    graphicsPath2.AddPath(graphicsPath, true);
                    graphicsPath2.CloseAllFigures();
                    using (Brush brush = this.GetChartFillBrush(graph))
                    {
                        graph.FillPath(brush, graphicsPath2);
                        if (this.axis.chartArea.ShadowOffset != 0 && !this.axis.chartArea.ShadowColor.IsEmpty)
                        {
                            RectangleF rect = breakLinePosition;
                            if (this.axis.AxisPosition == AxisPosition.Right || this.axis.AxisPosition == AxisPosition.Left)
                            {
                                rect.Y      += (float)this.axis.chartArea.ShadowOffset;
                                rect.Height -= (float)this.axis.chartArea.ShadowOffset;
                                rect.X       = (float)(rect.Right - 1.0);
                                rect.Width   = (float)(this.axis.chartArea.ShadowOffset + 2);
                            }
                            else
                            {
                                rect.X     += (float)this.axis.chartArea.ShadowOffset;
                                rect.Width -= (float)this.axis.chartArea.ShadowOffset;
                                rect.Y      = (float)(rect.Bottom - 1.0);
                                rect.Height = (float)(this.axis.chartArea.ShadowOffset + 2);
                            }
                            graph.FillRectangle(brush, rect);
                            using (GraphicsPath graphicsPath3 = new GraphicsPath())
                            {
                                graphicsPath3.AddPath(breakLinePath, false);
                                float val = (float)this.axis.chartArea.ShadowOffset;
                                val = ((this.axis.AxisPosition != AxisPosition.Right && this.axis.AxisPosition != 0) ? Math.Min(val, breakLinePosition.Width) : Math.Min(val, breakLinePosition.Height));
                                int        num = (int)((float)(int)this.axis.chartArea.ShadowColor.A / val);
                                RectangleF absoluteRectangle = graph.GetAbsoluteRectangle(this.axis.PlotAreaPosition.ToRectangleF());
                                if (this.axis.AxisPosition == AxisPosition.Right || this.axis.AxisPosition == AxisPosition.Left)
                                {
                                    absoluteRectangle.X     += (float)this.axis.chartArea.ShadowOffset;
                                    absoluteRectangle.Width += (float)this.axis.chartArea.ShadowOffset;
                                }
                                else
                                {
                                    absoluteRectangle.Y      += (float)this.axis.chartArea.ShadowOffset;
                                    absoluteRectangle.Height += (float)this.axis.chartArea.ShadowOffset;
                                }
                                graph.SetClip(graph.GetRelativeRectangle(absoluteRectangle));
                                for (int i = 0; (float)i < val; i++)
                                {
                                    using (Matrix matrix = new Matrix())
                                    {
                                        if (this.axis.AxisPosition == AxisPosition.Right || this.axis.AxisPosition == AxisPosition.Left)
                                        {
                                            matrix.Translate(0f, 1f);
                                        }
                                        else
                                        {
                                            matrix.Translate(1f, 0f);
                                        }
                                        graphicsPath3.Transform(matrix);
                                    }
                                    Color color = Color.FromArgb(this.axis.chartArea.ShadowColor.A - num * i, this.axis.chartArea.ShadowColor);
                                    using (Pen pen = new Pen(color, 1f))
                                    {
                                        graph.DrawPath(pen, graphicsPath3);
                                    }
                                }
                                graph.ResetClip();
                            }
                        }
                    }
                }
            }
            if (this.axis.ScaleBreakStyle.BreakLineType != 0)
            {
                using (Pen pen2 = new Pen(this.axis.ScaleBreakStyle.LineColor, (float)this.axis.ScaleBreakStyle.LineWidth))
                {
                    pen2.DashStyle = graph.GetPenStyle(this.axis.ScaleBreakStyle.LineStyle);
                    graph.DrawPath(pen2, breakLinePath);
                    if (breakLinePosition.Width > 0.0 && breakLinePosition.Height > 0.0)
                    {
                        graph.DrawPath(pen2, graphicsPath);
                    }
                }
            }
            breakLinePath.Dispose();
            breakLinePath = null;
            if (graphicsPath != null)
            {
                graphicsPath.Dispose();
                graphicsPath = null;
            }
        }
        private void FillAxisSegmentCollection(AxisScaleSegmentCollection axisSegments)
        {
            axisSegments.Clear();
            double num  = 0.0;
            double num2 = 0.0;
            double num3 = 0.0;

            double[] array  = null;
            double[] array2 = null;
            int[]    seriesDataStatistics = this.GetSeriesDataStatistics(this.totalNumberOfSegments, out num, out num2, out num3, out array, out array2);
            if (seriesDataStatistics != null)
            {
                double num4 = num;
                double num5 = num2;
                this.axis.EstimateNumberAxis(ref num4, ref num5, this.axis.StartFromZero, this.axis.prefferedNumberofIntervals, this.axis.Crossing, true, true);
                if (num2 != num)
                {
                    double    num6      = (num2 - num) / ((num5 - num4) / 100.0);
                    ArrayList arrayList = new ArrayList();
                    bool      flag      = false;
                    while (!flag)
                    {
                        flag = true;
                        int num7 = 0;
                        int num8 = 0;
                        this.GetLargestSequenseOfSegmentsWithNoPoints(seriesDataStatistics, out num7, out num8);
                        int num9 = (int)((double)this.minimumNumberOfEmptySegments * (100.0 / num6));
                        if (axisSegments.Count > 0 && num8 > 0)
                        {
                            foreach (AxisScaleSegment axisSegment in axisSegments)
                            {
                                if (num7 > 0 && num7 + num8 <= array.Length - 1 && array[num7 - 1] >= axisSegment.ScaleMinimum && array2[num7 + num8] <= axisSegment.ScaleMaximum)
                                {
                                    double num10 = axisSegment.ScaleMaximum - axisSegment.ScaleMinimum;
                                    double num11 = array2[num7 + num8] - array[num7 - 1];
                                    double num12 = num11 / (num10 / 100.0);
                                    num12 = num12 / 100.0 * axisSegment.Size;
                                    if (num12 > (double)num9 && (double)num8 > this.minSegmentSize)
                                    {
                                        num9 = num8;
                                    }
                                }
                            }
                        }
                        if (num8 >= num9)
                        {
                            flag = false;
                            arrayList.Add(num7);
                            arrayList.Add(num8);
                            axisSegments.Clear();
                            if (arrayList.Count > 0)
                            {
                                double num13 = double.NaN;
                                double num14 = double.NaN;
                                int    num15 = 0;
                                for (int i = 0; i < seriesDataStatistics.Length; i++)
                                {
                                    bool flag2 = this.IsExcludedSegment(arrayList, i);
                                    if (!flag2 && !double.IsNaN(array2[i]) && !double.IsNaN(array[i]))
                                    {
                                        num15 += seriesDataStatistics[i];
                                        if (double.IsNaN(num13))
                                        {
                                            num13 = array2[i];
                                            num14 = array[i];
                                        }
                                        else
                                        {
                                            num14 = array[i];
                                        }
                                    }
                                    if (!double.IsNaN(num13) && (flag2 || i == seriesDataStatistics.Length - 1))
                                    {
                                        if (num14 == num13)
                                        {
                                            num13 -= num3;
                                            num14 += num3;
                                        }
                                        AxisScaleSegment axisScaleSegment2 = new AxisScaleSegment();
                                        axisScaleSegment2.ScaleMaximum = num14;
                                        axisScaleSegment2.ScaleMinimum = num13;
                                        axisScaleSegment2.Tag          = num15;
                                        axisSegments.Add(axisScaleSegment2);
                                        num13 = double.NaN;
                                        num14 = double.NaN;
                                        num15 = 0;
                                    }
                                }
                            }
                            this.SetAxisSegmentPosition(axisSegments);
                        }
                        if (axisSegments.Count - 1 >= this.maximumNumberOfBreaks)
                        {
                            flag = true;
                        }
                    }
                }
            }
        }