コード例 #1
0
        private void DrawGrid(ChartGraphics graph, double current, int numberOfElements, int index)
        {
            CommonElements common     = this.axis.Common;
            PointF         point      = PointF.Empty;
            PointF         empty      = PointF.Empty;
            PointF         empty2     = PointF.Empty;
            RectangleF     rectangleF = this.axis.PlotAreaPosition.ToRectangleF();

            if (this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right)
            {
                empty.X  = rectangleF.X;
                empty2.X = rectangleF.Right;
                empty.Y  = (float)this.axis.GetLinearPosition(current);
                empty2.Y = empty.Y;
                point    = empty;
            }
            if (this.axis.AxisPosition == AxisPosition.Top || this.axis.AxisPosition == AxisPosition.Bottom)
            {
                empty.Y  = rectangleF.Y;
                empty2.Y = rectangleF.Bottom;
                empty.X  = (float)this.axis.GetLinearPosition(current);
                empty2.X = empty.X;
                point    = empty2;
            }
            if (common.ProcessModeRegions)
            {
                if (this.axis.chartArea.Area3DStyle.Enable3D && !this.axis.chartArea.chartAreaIsCurcular)
                {
                    graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, common, this);
                }
                else if (!this.axis.chartArea.chartAreaIsCurcular)
                {
                    GraphicsPath graphicsPath = new GraphicsPath();
                    if (Math.Abs(empty.X - empty2.X) > Math.Abs(empty.Y - empty2.Y))
                    {
                        graphicsPath.AddLine(empty.X, (float)(empty.Y - 1.0), empty2.X, (float)(empty2.Y - 1.0));
                        graphicsPath.AddLine(empty2.X, (float)(empty2.Y + 1.0), empty.X, (float)(empty.Y + 1.0));
                        graphicsPath.CloseAllFigures();
                    }
                    else
                    {
                        graphicsPath.AddLine((float)(empty.X - 1.0), empty.Y, (float)(empty2.X - 1.0), empty2.Y);
                        graphicsPath.AddLine((float)(empty2.X + 1.0), empty2.Y, (float)(empty.X + 1.0), empty.Y);
                        graphicsPath.CloseAllFigures();
                    }
                    common.HotRegionsList.AddHotRegion(graphicsPath, true, graph, ChartElementType.Gridlines, this);
                }
            }
            if (common.ProcessModePaint)
            {
                if (this.axis.chartArea.chartAreaIsCurcular)
                {
                    this.InitAnimation(this.axis.Common, point, graph, numberOfElements, index);
                    graph.StartAnimation();
                    if (this.axis.axisType == AxisName.Y)
                    {
                        this.axis.DrawCircularLine(this, graph, this.borderColor, this.borderWidth, this.borderStyle, empty.Y);
                    }
                    if (this.axis.axisType == AxisName.X)
                    {
                        ICircularChartType circularChartType = this.axis.chartArea.GetCircularChartType();
                        if (circularChartType != null && circularChartType.RadialGridLinesSupported())
                        {
                            this.axis.DrawRadialLine(this, graph, this.borderColor, this.borderWidth, this.borderStyle, current);
                        }
                    }
                    graph.StopAnimation();
                }
                else if (!this.axis.chartArea.Area3DStyle.Enable3D || this.axis.chartArea.chartAreaIsCurcular)
                {
                    this.InitAnimation(this.axis.Common, point, graph, numberOfElements, index);
                    graph.StartAnimation();
                    graph.DrawLineRel(this.borderColor, this.borderWidth, this.borderStyle, empty, empty2);
                    graph.StopAnimation();
                }
                else
                {
                    graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, this.axis.Common, this, numberOfElements, index);
                }
            }
        }
コード例 #2
0
ファイル: AxisLabels.cs プロジェクト: David-Lees/WebCharts
        /// <summary>
        /// Fill labels from data from data manager or
        /// from axis scale.
        /// </summary>
        /// <param name="removeFirstRow">True if first row of auto generated labels must be removed.</param>
        internal void FillLabels(bool removeFirstRow)
        {
#if SUBAXES
            // Process all sub-axis
            foreach (SubAxis subAxis in ((Axis)this).SubAxes)
            {
                subAxis.FillLabels(true);
            }
#endif // SUBAXES

            // Labels are disabled for this axis
            if (!LabelStyle.Enabled || !enabled)
            {
                return;
            }

            // For circular chart area fill only Y axis labels
            if (ChartArea != null && ChartArea.chartAreaIsCurcular && axisType != AxisName.Y)
            {
                ICircularChartType type = ChartArea.GetCircularChartType();
                if (type == null || !type.XAxisLabelsSupported())
                {
                    return;
                }
            }

            // Check if the custom labels exist
            bool customLabelsFlag = false;
            foreach (CustomLabel lab in CustomLabels)
            {
                if (lab.customLabel && (lab.RowIndex == 0 ||
                                        ChartArea.chartAreaIsCurcular))
                {
                    customLabelsFlag = true;
                }
            }

            // Remove the first row of labels if custom labels not exist
            if (removeFirstRow)
            {
                if (!customLabelsFlag)
                {
                    for (int index = 0; index < CustomLabels.Count; index++)
                    {
                        if (CustomLabels[index].RowIndex == 0)
                        {
                            CustomLabels.RemoveAt(index);
                            index = -1;
                        }
                    }
                }
                else
                {
                    return;
                }
            }

            // Get data series for this axis.
            List <string> dataSeries = null;
            switch (axisType)
            {
            case AxisName.X:
                dataSeries = ChartArea.GetXAxesSeries(AxisType.Primary, SubAxisName);
                break;

            case AxisName.Y:
                dataSeries = ChartArea.GetYAxesSeries(AxisType.Primary, SubAxisName);
                break;

            case AxisName.X2:
                dataSeries = ChartArea.GetXAxesSeries(AxisType.Secondary, SubAxisName);
                break;

            case AxisName.Y2:
                dataSeries = ChartArea.GetYAxesSeries(AxisType.Secondary, SubAxisName);
                break;
            }

            // There aren't data series connected with this axis.
            if (dataSeries == null || dataSeries.Count == 0)
            {
                return;
            }

            //Let's convert the ArrayList of the series names into to string[]
            string[] dataSeriesNames = new string[dataSeries.Count];
            for (int i = 0; i < dataSeries.Count; i++)
            {
                dataSeriesNames[i] = dataSeries[i];
            }

            // Check if series X values all set to zeros
            bool seriesXValuesZeros = ChartHelper.SeriesXValuesZeros(Common, dataSeriesNames);

            // Check if series is indexed (All X values zeros or IsXValueIndexed flag set)
            bool indexedSeries = true;
            if (!seriesXValuesZeros)
            {
                indexedSeries = ChartHelper.IndexedSeries(Common, dataSeriesNames);
            }

            // Show End Labels
            int endLabels = 0;
            if (labelStyle.IsEndLabelVisible)
            {
                endLabels = 1;
            }

            // Get chart type of the first series
            IChartType chartType  = Common.ChartTypeRegistry.GetChartType(ChartArea.GetFirstSeries().ChartTypeName);
            bool       fromSeries = false;
            if (!chartType.RequireAxes)
            {
                return;
            }
            else if (axisType == AxisName.Y || axisType == AxisName.Y2)
            {
                fromSeries = false;
            }
            else
            {
                fromSeries = true;
            }

            // X values from data points are not 0.
            if (fromSeries && !ChartHelper.SeriesXValuesZeros(Common, dataSeries.ToArray()))
            {
                fromSeries = false;
            }

            // X values from data points are not 0.
            if (fromSeries && (labelStyle.GetIntervalOffset() != 0 || labelStyle.GetInterval() != 0))
            {
                fromSeries = false;
            }

            // Get value type
            ChartValueType valueType;
            if (axisType == AxisName.X || axisType == AxisName.X2)
            {
                // If X value is indexed the type is always String. So we use indexed type instead
                valueType = Common.DataManager.Series[dataSeries[0]].indexedXValueType;
            }
            else
            {
                valueType = Common.DataManager.Series[dataSeries[0]].YValueType;
            }

            if (labelStyle.GetIntervalType() != DateTimeIntervalType.Auto &&
                labelStyle.GetIntervalType() != DateTimeIntervalType.Number &&
                valueType != ChartValueType.Time &&
                valueType != ChartValueType.Date &&
                valueType != ChartValueType.DateTimeOffset)
            {
                valueType = ChartValueType.DateTime;
            }

            // ***********************************
            // Pre calculate some values
            // ***********************************
            double viewMaximum = ViewMaximum;
            double viewMinimum = ViewMinimum;

            // ***********************************
            // Labels are filled from data series.
            // ***********************************
            if (fromSeries)
            {
                int numOfPoints;
                numOfPoints = Common.DataManager.GetNumberOfPoints(dataSeries.ToArray());

                // Show end labels
                if (endLabels == 1)
                {
                    // min position
                    CustomLabels.Add(-0.5, 0.5, ValueConverter.FormatValue(
                                         Common.Chart,
                                         this,
                                         null,
                                         0.0,
                                         LabelStyle.Format,
                                         valueType,
                                         ChartElementType.AxisLabels),
                                     false);
                }

                // Labels from point position
                for (int point = 0; point < numOfPoints; point++)
                {
                    CustomLabels.Add(point + 0.5, point + 1.5,
                                     ValueConverter.FormatValue(
                                         Common.Chart,
                                         this,
                                         null,
                                         point + 1,
                                         LabelStyle.Format,
                                         valueType,
                                         ChartElementType.AxisLabels),
                                     false);
                }

                // Show end labels
                if (endLabels == 1)
                {
                    // max position
                    CustomLabels.Add(numOfPoints + 0.5, numOfPoints + 1.5,
                                     ValueConverter.FormatValue(
                                         Common.Chart,
                                         this,
                                         null,
                                         numOfPoints + 1,
                                         LabelStyle.Format,
                                         valueType,
                                         ChartElementType.AxisLabels),
                                     false);
                }

                int pointIndx;
                foreach (string seriesIndx in dataSeries)
                {
                    // End labels enabled
                    if (endLabels == 1)
                    {
                        pointIndx = 1;
                    }
                    else
                    {
                        pointIndx = 0;
                    }

                    // Set labels from data points labels
                    foreach (DataPoint dataPoint in Common.DataManager.Series[seriesIndx].Points)
                    {
                        // Find first row of labels
                        while (CustomLabels[pointIndx].RowIndex > 0)
                        {
                            pointIndx++;
                        }

                        // Add X labels
                        if ((axisType == AxisName.X || axisType == AxisName.X2) && dataPoint.AxisLabel.Length > 0)
                        {
                            CustomLabels[pointIndx].Text = dataPoint.AxisLabel;
                        }

                        pointIndx++;
                    }
                }
            }
            // ***********************************
            // Labels are filled from axis scale.
            // ***********************************
            else
            {
                if (viewMinimum == viewMaximum)
                {
                    return;
                }

                double labValue;      // Value, which will be converted to text and used for, labels.
                double beginPosition; // Begin position for a label
                double endPosition;   // End position for a label
                double start;         // Start position for all labels

                // Get first series attached to this axis
                Series axisSeries = null;
                if (axisType == AxisName.X || axisType == AxisName.X2)
                {
                    List <string> seriesArray = ChartArea.GetXAxesSeries((axisType == AxisName.X) ? AxisType.Primary : AxisType.Secondary, SubAxisName);
                    if (seriesArray.Count > 0)
                    {
                        axisSeries = Common.DataManager.Series[seriesArray[0]];
                        if (axisSeries != null && !axisSeries.IsXValueIndexed)
                        {
                            axisSeries = null;
                        }
                    }
                }

                // ***********************************
                // Check if the AJAX zooming and scrolling mode is enabled.
                // Labels are filled slightly different in this case.
                // ***********************************
                DateTimeIntervalType offsetType = (labelStyle.GetIntervalOffsetType() == DateTimeIntervalType.Auto) ? labelStyle.GetIntervalType() : labelStyle.GetIntervalOffsetType();

                // By default start is equal to minimum
                start = viewMinimum;

                // Adjust start position depending on the interval type
                if (!ChartArea.chartAreaIsCurcular ||
                    axisType == AxisName.Y ||
                    axisType == AxisName.Y2)
                {
                    start = ChartHelper.AlignIntervalStart(start, labelStyle.GetInterval(), labelStyle.GetIntervalType(), axisSeries);
                }

                // Move start if there is start position
                if (labelStyle.GetIntervalOffset() != 0 && axisSeries == null)
                {
                    start += ChartHelper.GetIntervalSize(start, labelStyle.GetIntervalOffset(),
                                                         offsetType, axisSeries, 0, DateTimeIntervalType.Number, true, false);
                }

                // ***************************************
                // Date type
                // ***************************************
                if (valueType == ChartValueType.DateTime ||
                    valueType == ChartValueType.Date ||
                    valueType == ChartValueType.Time ||
                    valueType == ChartValueType.DateTimeOffset ||
                    axisSeries != null)
                {
                    double position = start;
                    double dateInterval;

                    // Too many labels
                    if ((viewMaximum - start) / ChartHelper.GetIntervalSize(start, labelStyle.GetInterval(), labelStyle.GetIntervalType(), axisSeries, 0, DateTimeIntervalType.Number, true) > ChartHelper.MaxNumOfGridlines)
                    {
                        return;
                    }

                    int    counter             = 0;
                    double endLabelMaxPosition = viewMaximum - ChartHelper.GetIntervalSize(viewMaximum, labelStyle.GetInterval(), labelStyle.GetIntervalType(), axisSeries, labelStyle.GetIntervalOffset(), offsetType, true) / 2f;
                    double endLabelMinPosition = viewMinimum + ChartHelper.GetIntervalSize(viewMinimum, labelStyle.GetInterval(), labelStyle.GetIntervalType(), axisSeries, labelStyle.GetIntervalOffset(), offsetType, true) / 2f;
                    while ((decimal)position <= (decimal)viewMaximum)
                    {
                        dateInterval = ChartHelper.GetIntervalSize(position, labelStyle.GetInterval(), labelStyle.GetIntervalType(), axisSeries, labelStyle.GetIntervalOffset(), offsetType, true);
                        labValue     = position;

                        // For IsLogarithmic axes
                        if (IsLogarithmic)
                        {
                            labValue = Math.Pow(logarithmBase, labValue);
                        }

                        // Check if we do not exceed max number of elements
                        if (counter++ > ChartHelper.MaxNumOfGridlines)
                        {
                            break;
                        }

                        if (endLabels == 0 && position >= endLabelMaxPosition)
                        {
                            break;
                        }

                        beginPosition = position - dateInterval * 0.5;
                        endPosition   = position + dateInterval * 0.5;

                        if (endLabels == 0 && position <= endLabelMinPosition)
                        {
                            position += dateInterval;
                            continue;
                        }

                        if ((decimal)beginPosition > (decimal)viewMaximum)
                        {
                            position += dateInterval;
                            continue;
                        }

                        string pointLabel = GetPointLabel(dataSeries, labValue, !seriesXValuesZeros, indexedSeries);
                        if (pointLabel.Length == 0)
                        {
                            // Do not draw last label for indexed series
                            if (position <= maximum && (position != maximum || !Common.DataManager.Series[dataSeries[0]].IsXValueIndexed))
                            {
                                CustomLabels.Add(beginPosition,
                                                 endPosition,
                                                 ValueConverter.FormatValue(
                                                     Common.Chart,
                                                     this,
                                                     null,
                                                     labValue,
                                                     LabelStyle.Format,
                                                     valueType,
                                                     ChartElementType.AxisLabels),
                                                 false);
                            }
                        }
                        else
                        {
                            // Add a label to the collection
                            CustomLabels.Add(beginPosition,
                                             endPosition,
                                             pointLabel,
                                             false);
                        }
                        position += dateInterval;
                    }
                }
                else
                {
                    // ***************************************
                    // Scale value type
                    // ***************************************

                    // Show First label if Start Label position is used
                    if (start != viewMinimum)
                    {
                        endLabels = 1;
                    }

                    // Set labels
                    int labelCounter = 0;
                    for (double position = start - endLabels * labelStyle.GetInterval(); position < viewMaximum - 1.5 * labelStyle.GetInterval() * (1 - endLabels); position = (double)((decimal)position + (decimal)labelStyle.GetInterval()))
                    {
                        // Prevent endless loop that may be caused by very small interval
                        // and double/decimal rounding errors
                        ++labelCounter;
                        if (labelCounter > ChartHelper.MaxNumOfGridlines)
                        {
                            break;
                        }

                        labValue = (double)((decimal)position + (decimal)labelStyle.GetInterval());

                        // This line is introduce because sometimes 0 value will appear as
                        // very small value close to zero.
                        double inter  = Math.Log(labelStyle.GetInterval());
                        double valu   = Math.Log(Math.Abs(labValue));
                        int    digits = (int)Math.Abs(inter) + 5;

                        if (digits > 15)
                        {
                            digits = 15;
                        }

                        if (Math.Abs(inter) < Math.Abs(valu) - 5)
                        {
                            labValue = Math.Round(labValue, digits);
                        }

                        // Too many labels
                        if ((viewMaximum - start) / labelStyle.GetInterval() > ChartHelper.MaxNumOfGridlines)
                        {
                            return;
                        }

                        // For IsLogarithmic axes
                        if (IsLogarithmic)
                        {
                            labValue = Math.Pow(logarithmBase, labValue);
                        }

                        beginPosition = (double)((decimal)position + (decimal)labelStyle.GetInterval() * 0.5m);
                        endPosition   = (double)((decimal)position + (decimal)labelStyle.GetInterval() * 1.5m);

                        if ((decimal)beginPosition > (decimal)viewMaximum)
                        {
                            continue;
                        }

                        // Show End label if Start Label position is used
                        // Use decimal type to solve rounding issues
                        if ((decimal)((beginPosition + endPosition) / 2.0) > (decimal)viewMaximum)
                        {
                            continue;
                        }

                        string pointLabel = GetPointLabel(dataSeries, labValue, !seriesXValuesZeros, indexedSeries);
                        if (pointLabel.Length > 15 && labValue < 0.000001)
                        {
                            labValue = 0.0;
                        }

                        if (pointLabel.Length == 0)
                        {
                            // Do not draw last label for indexed series
                            if (!(Common.DataManager.Series[dataSeries[0]].IsXValueIndexed && position > maximum))
                            {
                                // Add a label to the collection
                                CustomLabels.Add(beginPosition,
                                                 endPosition,
                                                 ValueConverter.FormatValue(
                                                     Common.Chart,
                                                     this,
                                                     null,
                                                     labValue,
                                                     LabelStyle.Format,
                                                     valueType,
                                                     ChartElementType.AxisLabels),
                                                 false);
                            }
                        }
                        else
                        {
                            // Add a label to the collection
                            CustomLabels.Add(beginPosition,
                                             endPosition,
                                             pointLabel,
                                             false);
                        }
                    }
                }
            }
        }
コード例 #3
0
        internal void FillLabels(bool removeFirstRow)
        {
            if (!LabelStyle.Enabled || !enabled)
            {
                return;
            }
            if (chartArea != null && chartArea.chartAreaIsCurcular && axisType != AxisName.Y)
            {
                ICircularChartType circularChartType = chartArea.GetCircularChartType();
                if (circularChartType == null || !circularChartType.XAxisLabelsSupported())
                {
                    return;
                }
            }
            bool flag = false;

            foreach (CustomLabel customLabel in CustomLabels)
            {
                if (customLabel.customLabel && (customLabel.RowIndex == 0 || chartArea.chartAreaIsCurcular))
                {
                    flag = true;
                }
                if (customLabel.customLabel && base.Common.Chart != null && base.Common.Chart.LocalizeTextHandler != null)
                {
                    customLabel.Text = base.Common.Chart.LocalizeTextHandler(customLabel, customLabel.Text, 0, ChartElementType.AxisLabels);
                }
            }
            if (removeFirstRow)
            {
                if (flag)
                {
                    return;
                }
                for (int i = 0; i < CustomLabels.Count; i++)
                {
                    if (CustomLabels[i].RowIndex == 0)
                    {
                        CustomLabels.RemoveAt(i);
                        i = -1;
                    }
                }
            }
            ArrayList arrayList = null;

            switch (axisType)
            {
            case AxisName.X:
                arrayList = chartArea.GetXAxesSeries(AxisType.Primary, ((Axis)this).SubAxisName);
                break;

            case AxisName.Y:
                arrayList = chartArea.GetYAxesSeries(AxisType.Primary, ((Axis)this).SubAxisName);
                break;

            case AxisName.X2:
                arrayList = chartArea.GetXAxesSeries(AxisType.Secondary, ((Axis)this).SubAxisName);
                break;

            case AxisName.Y2:
                arrayList = chartArea.GetYAxesSeries(AxisType.Secondary, ((Axis)this).SubAxisName);
                break;
            }
            if (arrayList.Count == 0)
            {
                return;
            }
            string[] array = new string[arrayList.Count];
            for (int j = 0; j < arrayList.Count; j++)
            {
                array[j] = (string)arrayList[j];
            }
            bool flag2         = SeriesXValuesZeros(array);
            bool indexedSeries = true;

            if (!flag2)
            {
                indexedSeries = IndexedSeries(array);
            }
            int num = 0;

            if (labelStyle.ShowEndLabels)
            {
                num = 1;
            }
            IChartType chartType = base.Common.ChartTypeRegistry.GetChartType(chartArea.GetFirstSeries().ChartTypeName);
            bool       flag3     = false;

            if (!chartType.RequireAxes)
            {
                return;
            }
            flag3 = ((axisType != AxisName.Y && axisType != AxisName.Y2) ? true : false);
            if (flag3 && !SeriesXValuesZeros((string[])arrayList.ToArray(typeof(string))))
            {
                flag3 = false;
            }
            if (flag3 && (labelStyle.IntervalOffset != 0.0 || labelStyle.Interval != 0.0))
            {
                flag3 = false;
            }
            ChartValueTypes chartValueTypes = (axisType != 0 && axisType != AxisName.X2) ? base.Common.DataManager.Series[arrayList[0]].YValueType : base.Common.DataManager.Series[arrayList[0]].indexedXValueType;

            if (labelStyle.IntervalType != 0 && labelStyle.IntervalType != DateTimeIntervalType.Number && chartValueTypes != ChartValueTypes.Time && chartValueTypes != ChartValueTypes.Date && chartValueTypes != ChartValueTypes.DateTimeOffset)
            {
                chartValueTypes = ChartValueTypes.DateTime;
            }
            double viewMaximum = GetViewMaximum();
            double viewMinimum = GetViewMinimum();

            if (flag3)
            {
                int numberOfPoints = base.Common.DataManager.GetNumberOfPoints((string[])arrayList.ToArray(typeof(string)));
                if (num == 1)
                {
                    CustomLabels.Add(-0.5, 0.5, ValueConverter.FormatValue(base.Common.Chart, this, 0.0, LabelStyle.Format, chartValueTypes, ChartElementType.AxisLabels), customLabel: false);
                }
                for (int k = 0; k < numberOfPoints; k++)
                {
                    CustomLabels.Add((double)k + 0.5, (double)k + 1.5, ValueConverter.FormatValue(base.Common.Chart, this, k + 1, LabelStyle.Format, chartValueTypes, ChartElementType.AxisLabels), customLabel: false);
                }
                if (num == 1)
                {
                    CustomLabels.Add((double)numberOfPoints + 0.5, (double)numberOfPoints + 1.5, ValueConverter.FormatValue(base.Common.Chart, this, numberOfPoints + 1, LabelStyle.Format, chartValueTypes, ChartElementType.AxisLabels), customLabel: false);
                }
                foreach (string item in arrayList)
                {
                    int l = (num == 1) ? 1 : 0;
                    foreach (DataPoint point in base.Common.DataManager.Series[item].Points)
                    {
                        for (; CustomLabels[l].RowIndex > 0; l++)
                        {
                        }
                        if ((axisType == AxisName.X || axisType == AxisName.X2) && point.AxisLabel.Length > 0)
                        {
                            CustomLabels[l].Text = point.AxisLabel;
                            if (base.Common.Chart != null && base.Common.Chart.LocalizeTextHandler != null)
                            {
                                CustomLabels[l].Text = base.Common.Chart.LocalizeTextHandler(point, CustomLabels[l].Text, point.ElementId, ChartElementType.DataPoint);
                            }
                        }
                        l++;
                    }
                }
            }
            else
            {
                if (viewMinimum == viewMaximum)
                {
                    return;
                }
                Series series = null;
                if (axisType == AxisName.X || axisType == AxisName.X2)
                {
                    ArrayList xAxesSeries = chartArea.GetXAxesSeries((axisType != 0) ? AxisType.Secondary : AxisType.Primary, ((Axis)this).SubAxisName);
                    if (xAxesSeries.Count > 0)
                    {
                        series = base.Common.DataManager.Series[xAxesSeries[0]];
                        if (series != null && !series.XValueIndexed)
                        {
                            series = null;
                        }
                    }
                }
                DateTimeIntervalType dateTimeIntervalType = (labelStyle.IntervalOffsetType == DateTimeIntervalType.Auto) ? labelStyle.IntervalType : labelStyle.IntervalOffsetType;
                double num2 = viewMinimum;
                if (!chartArea.chartAreaIsCurcular || axisType == AxisName.Y || axisType == AxisName.Y2)
                {
                    num2 = AlignIntervalStart(num2, labelStyle.Interval, labelStyle.IntervalType, series);
                }
                if (labelStyle.IntervalOffset != 0.0 && series == null)
                {
                    num2 += GetIntervalSize(num2, labelStyle.IntervalOffset, dateTimeIntervalType, series, 0.0, DateTimeIntervalType.Number, forceIntIndex: true, forceAbsInterval: false);
                }
                if (chartValueTypes == ChartValueTypes.DateTime || chartValueTypes == ChartValueTypes.Date || chartValueTypes == ChartValueTypes.Time || chartValueTypes == ChartValueTypes.DateTimeOffset || series != null)
                {
                    double num3 = num2;
                    if ((viewMaximum - num2) / GetIntervalSize(num2, labelStyle.Interval, labelStyle.IntervalType, series, 0.0, DateTimeIntervalType.Number, forceIntIndex: true) > 10000.0)
                    {
                        return;
                    }
                    int    num4 = 0;
                    double num5 = viewMaximum - GetIntervalSize(viewMaximum, labelStyle.Interval, labelStyle.IntervalType, series, labelStyle.IntervalOffset, dateTimeIntervalType, forceIntIndex: true) / 2.0;
                    double num6 = viewMinimum + GetIntervalSize(viewMinimum, labelStyle.Interval, labelStyle.IntervalType, series, labelStyle.IntervalOffset, dateTimeIntervalType, forceIntIndex: true) / 2.0;
                    while ((decimal)num3 <= (decimal)viewMaximum)
                    {
                        double intervalSize = GetIntervalSize(num3, labelStyle.Interval, labelStyle.IntervalType, series, labelStyle.IntervalOffset, dateTimeIntervalType, forceIntIndex: true);
                        double num7         = num3;
                        if (base.Logarithmic)
                        {
                            num7 = Math.Pow(logarithmBase, num7);
                        }
                        if (num4++ > 10000 || (num == 0 && num3 >= num5))
                        {
                            break;
                        }
                        double num8       = num3 - intervalSize * 0.5;
                        double toPosition = num3 + intervalSize * 0.5;
                        if (num == 0 && num3 <= num6)
                        {
                            num3 += intervalSize;
                            continue;
                        }
                        if ((decimal)num8 > (decimal)viewMaximum)
                        {
                            num3 += intervalSize;
                            continue;
                        }
                        string pointLabel = GetPointLabel(arrayList, num7, !flag2, indexedSeries);
                        if (pointLabel.Length == 0)
                        {
                            if (num3 <= maximum && (num3 != maximum || !base.Common.DataManager.Series[arrayList[0]].XValueIndexed))
                            {
                                CustomLabels.Add(num8, toPosition, ValueConverter.FormatValue(base.Common.Chart, this, num7, LabelStyle.Format, chartValueTypes, ChartElementType.AxisLabels), customLabel: false);
                            }
                        }
                        else
                        {
                            CustomLabels.Add(num8, toPosition, pointLabel, customLabel: false);
                        }
                        num3 += intervalSize;
                    }
                    return;
                }
                if (num2 != viewMinimum)
                {
                    num = 1;
                }
                int num9 = 0;
                for (double num10 = num2 - (double)num * labelStyle.Interval; num10 < viewMaximum - 1.5 * labelStyle.Interval * (double)(1 - num); num10 = (double)((decimal)num10 + (decimal)labelStyle.Interval))
                {
                    num9++;
                    if (num9 > 10000)
                    {
                        break;
                    }
                    double num7   = Axis.RemoveNoiseFromDoubleMath(num10) + Axis.RemoveNoiseFromDoubleMath(labelStyle.Interval);
                    double value  = Math.Log(labelStyle.Interval);
                    double value2 = Math.Log(Math.Abs(num7));
                    int    num11  = (int)Math.Abs(value) + 5;
                    if (num11 > 15)
                    {
                        num11 = 15;
                    }
                    if (Math.Abs(value) < Math.Abs(value2) - 5.0)
                    {
                        num7 = Math.Round(num7, num11);
                    }
                    if ((viewMaximum - num2) / labelStyle.Interval > 10000.0)
                    {
                        break;
                    }
                    if (base.Logarithmic)
                    {
                        num7 = Math.Pow(logarithmBase, num7);
                    }
                    double num8       = (double)((decimal)num10 + (decimal)labelStyle.Interval * 0.5m);
                    double toPosition = (double)((decimal)num10 + (decimal)labelStyle.Interval * 1.5m);
                    if (!((decimal)num8 > (decimal)viewMaximum) && !((decimal)((num8 + toPosition) / 2.0) > (decimal)viewMaximum))
                    {
                        string pointLabel2 = GetPointLabel(arrayList, num7, !flag2, indexedSeries);
                        if (pointLabel2.Length > 15 && num7 < 1E-06)
                        {
                            num7 = 0.0;
                        }
                        if (pointLabel2.Length == 0)
                        {
                            if (!base.Common.DataManager.Series[arrayList[0]].XValueIndexed || !(num10 > maximum))
                            {
                                CustomLabels.Add(num8, toPosition, ValueConverter.FormatValue(base.Common.Chart, this, num7, LabelStyle.Format, chartValueTypes, ChartElementType.AxisLabels), customLabel: false);
                            }
                        }
                        else
                        {
                            CustomLabels.Add(num8, toPosition, pointLabel2, customLabel: false);
                        }
                    }
                }
            }
        }