internal void GetAxisSegmentForScaleBreaks(AxisScaleSegmentCollection axisSegments)
        {
            axisSegments.Clear();
            if (!IsEnabled())
            {
                return;
            }
            FillAxisSegmentCollection(axisSegments);
            if (axisSegments.Count < 1)
            {
                return;
            }
            int startScaleFromZeroSegmentIndex = GetStartScaleFromZeroSegmentIndex(axisSegments);
            int num = 0;

            foreach (AxisScaleSegment axisSegment in axisSegments)
            {
                bool   shouldStartFromZero = (num == startScaleFromZeroSegmentIndex) ? true : false;
                double minimum             = axisSegment.ScaleMinimum;
                double maximum             = axisSegment.ScaleMaximum;
                axisSegment.Interval     = axis.EstimateNumberAxis(ref minimum, ref maximum, shouldStartFromZero, axis.prefferedNumberofIntervals, axis.Crossing, autoMaximum: true, autoMinimum: true);
                axisSegment.ScaleMinimum = minimum;
                axisSegment.ScaleMaximum = maximum;
                if (axisSegment.ScaleMinimum < axis.Minimum)
                {
                    axisSegment.ScaleMinimum = axis.Minimum;
                }
                if (axisSegment.ScaleMaximum > axis.Maximum)
                {
                    axisSegment.ScaleMaximum = 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)
            {
                SetAxisSegmentPosition(axisSegments);
            }
        }
        private void FillAxisSegmentCollection(AxisScaleSegmentCollection axisSegments)
        {
            axisSegments.Clear();
            double minYValue   = 0.0;
            double maxYValue   = 0.0;
            double segmentSize = 0.0;

            double[] segmentMaxValue      = null;
            double[] segmentMinValue      = null;
            int[]    seriesDataStatistics = GetSeriesDataStatistics(totalNumberOfSegments, out minYValue, out maxYValue, out segmentSize, out segmentMaxValue, out segmentMinValue);
            if (seriesDataStatistics == null)
            {
                return;
            }
            double minimum = minYValue;
            double maximum = maxYValue;

            axis.EstimateNumberAxis(ref minimum, ref maximum, axis.StartFromZero, axis.prefferedNumberofIntervals, axis.Crossing, autoMaximum: true, autoMinimum: true);
            if (maxYValue == minYValue)
            {
                return;
            }
            double    num       = (maxYValue - minYValue) / ((maximum - minimum) / 100.0);
            ArrayList arrayList = new ArrayList();
            bool      flag      = false;

            while (!flag)
            {
                flag = true;
                int startSegment     = 0;
                int numberOfSegments = 0;
                GetLargestSequenseOfSegmentsWithNoPoints(seriesDataStatistics, out startSegment, out numberOfSegments);
                int num2 = (int)((double)minimumNumberOfEmptySegments * (100.0 / num));
                if (axisSegments.Count > 0 && numberOfSegments > 0)
                {
                    foreach (AxisScaleSegment axisSegment in axisSegments)
                    {
                        if (startSegment > 0 && startSegment + numberOfSegments <= segmentMaxValue.Length - 1 && segmentMaxValue[startSegment - 1] >= axisSegment.ScaleMinimum && segmentMinValue[startSegment + numberOfSegments] <= axisSegment.ScaleMaximum)
                        {
                            double num3 = axisSegment.ScaleMaximum - axisSegment.ScaleMinimum;
                            if ((segmentMinValue[startSegment + numberOfSegments] - segmentMaxValue[startSegment - 1]) / (num3 / 100.0) / 100.0 * axisSegment.Size > (double)num2 && (double)numberOfSegments > minSegmentSize)
                            {
                                num2 = numberOfSegments;
                            }
                        }
                    }
                }
                if (numberOfSegments >= num2)
                {
                    flag = false;
                    arrayList.Add(startSegment);
                    arrayList.Add(numberOfSegments);
                    axisSegments.Clear();
                    if (arrayList.Count > 0)
                    {
                        double num4 = double.NaN;
                        double num5 = double.NaN;
                        int    num6 = 0;
                        for (int i = 0; i < seriesDataStatistics.Length; i++)
                        {
                            bool flag2 = IsExcludedSegment(arrayList, i);
                            if (!flag2 && !double.IsNaN(segmentMinValue[i]) && !double.IsNaN(segmentMaxValue[i]))
                            {
                                num6 += seriesDataStatistics[i];
                                if (double.IsNaN(num4))
                                {
                                    num4 = segmentMinValue[i];
                                    num5 = segmentMaxValue[i];
                                }
                                else
                                {
                                    num5 = segmentMaxValue[i];
                                }
                            }
                            if (!double.IsNaN(num4) && (flag2 || i == seriesDataStatistics.Length - 1))
                            {
                                if (num5 == num4)
                                {
                                    num4 -= segmentSize;
                                    num5 += segmentSize;
                                }
                                AxisScaleSegment axisScaleSegment2 = new AxisScaleSegment();
                                axisScaleSegment2.ScaleMaximum = num5;
                                axisScaleSegment2.ScaleMinimum = num4;
                                axisScaleSegment2.Tag          = num6;
                                axisSegments.Add(axisScaleSegment2);
                                num4 = double.NaN;
                                num5 = double.NaN;
                                num6 = 0;
                            }
                        }
                    }
                    SetAxisSegmentPosition(axisSegments);
                }
                if (axisSegments.Count - 1 >= maximumNumberOfBreaks)
                {
                    flag = true;
                }
            }
        }