private void DrawLabels3D(ChartArea area, Axis hAxis, ChartGraphics graph, CommonElements common, RectangleF rectSize, DataPoint3D pointEx, Series ser, double barStartPosition, double barSize, double width, int pointIndex)
        {
            DataPoint dataPoint = pointEx.dataPoint;

            if (!ser.ShowLabelAsValue && !dataPoint.ShowLabelAsValue && dataPoint.Label.Length <= 0)
            {
                return;
            }
            RectangleF   rectangleF = RectangleF.Empty;
            StringFormat format     = new StringFormat();
            string       text;

            if (dataPoint.Label.Length == 0)
            {
                double value = GetYValue(common, area, ser, dataPoint, pointIndex, -2);
                if (hundredPercentStacked && dataPoint.LabelFormat.Length == 0)
                {
                    value = Math.Round(value, 2);
                }
                text = ValueConverter.FormatValue(ser.chart, dataPoint, value, dataPoint.LabelFormat, ser.YValueType, ChartElementType.DataPoint);
            }
            else
            {
                text = dataPoint.ReplaceKeywords(dataPoint.Label);
                if (ser.chart != null && ser.chart.LocalizeTextHandler != null)
                {
                    text = ser.chart.LocalizeTextHandler(dataPoint, text, dataPoint.ElementId, ChartElementType.DataPoint);
                }
            }
            SizeF size = SizeF.Empty;

            if ((dataPoint.MarkerStyle != 0 || dataPoint.MarkerImage.Length > 0) && pointEx.index % ser.MarkerStep == 0)
            {
                if (dataPoint.MarkerImage.Length == 0)
                {
                    size.Width  = dataPoint.MarkerSize;
                    size.Height = dataPoint.MarkerSize;
                }
                else
                {
                    Image image = common.ImageLoader.LoadImage(dataPoint.MarkerImage);
                    size.Width  = image.Width;
                    size.Height = image.Height;
                }
                size = graph.GetRelativeSize(size);
            }
            BarValueLabelDrawingStyle barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Center;
            string text2 = "";

            if (dataPoint.IsAttributeSet("BarLabelStyle"))
            {
                text2 = dataPoint["BarLabelStyle"];
            }
            else if (ser.IsAttributeSet("BarLabelStyle"))
            {
                text2 = ser["BarLabelStyle"];
            }
            if (text2 != null && text2.Length > 0)
            {
                if (string.Compare(text2, "Left", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Left;
                }
                else if (string.Compare(text2, "Right", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Right;
                }
                else if (string.Compare(text2, "Center", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Center;
                }
                else if (string.Compare(text2, "Outside", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Outside;
                }
            }
            bool flag = false;

            while (!flag)
            {
                format.Alignment     = StringAlignment.Near;
                format.LineAlignment = StringAlignment.Center;
                if (barStartPosition < barSize)
                {
                    rectangleF.X     = rectSize.Right;
                    rectangleF.Width = area.PlotAreaPosition.Right() - rectSize.Right;
                }
                else
                {
                    rectangleF.X     = area.PlotAreaPosition.X;
                    rectangleF.Width = rectSize.X - area.PlotAreaPosition.X;
                }
                rectangleF.Y      = rectSize.Y - (float)width / 2f;
                rectangleF.Height = rectSize.Height + (float)width;
                switch (barValueLabelDrawingStyle)
                {
                case BarValueLabelDrawingStyle.Outside:
                    if (!size.IsEmpty)
                    {
                        rectangleF.Width -= Math.Min(rectangleF.Width, size.Width / 2f);
                        if (barStartPosition < barSize)
                        {
                            rectangleF.X += Math.Min(rectangleF.Width, size.Width / 2f);
                        }
                    }
                    break;

                case BarValueLabelDrawingStyle.Left:
                    rectangleF       = rectSize;
                    format.Alignment = StringAlignment.Near;
                    break;

                case BarValueLabelDrawingStyle.Center:
                    rectangleF       = rectSize;
                    format.Alignment = StringAlignment.Center;
                    break;

                case BarValueLabelDrawingStyle.Right:
                    rectangleF       = rectSize;
                    format.Alignment = StringAlignment.Far;
                    if (!size.IsEmpty)
                    {
                        rectangleF.Width -= Math.Min(rectangleF.Width, size.Width / 2f);
                        if (barStartPosition >= barSize)
                        {
                            rectangleF.X += Math.Min(rectangleF.Width, size.Width / 2f);
                        }
                    }
                    break;
                }
                if (barStartPosition >= barSize)
                {
                    if (format.Alignment == StringAlignment.Far)
                    {
                        format.Alignment = StringAlignment.Near;
                    }
                    else if (format.Alignment == StringAlignment.Near)
                    {
                        format.Alignment = StringAlignment.Far;
                    }
                }
                flag = true;
            }
            SizeF  sizeF = graph.MeasureStringRel(text, dataPoint.Font, new SizeF(rectangleF.Width, rectangleF.Height), format);
            PointF empty = PointF.Empty;

            if (format.Alignment == StringAlignment.Near)
            {
                empty.X = rectangleF.X + sizeF.Width / 2f;
            }
            else if (format.Alignment == StringAlignment.Far)
            {
                empty.X = rectangleF.Right - sizeF.Width / 2f;
            }
            else
            {
                empty.X = (rectangleF.Left + rectangleF.Right) / 2f;
            }
            if (format.LineAlignment == StringAlignment.Near)
            {
                empty.Y = rectangleF.Top + sizeF.Height / 2f;
            }
            else if (format.LineAlignment == StringAlignment.Far)
            {
                empty.Y = rectangleF.Bottom - sizeF.Height / 2f;
            }
            else
            {
                empty.Y = (rectangleF.Bottom + rectangleF.Top) / 2f;
            }
            format.Alignment     = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;
            int num = dataPoint.FontAngle;

            Point3D[] array = new Point3D[2]
            {
                new Point3D(empty.X, empty.Y, pointEx.zPosition + pointEx.depth),
                new Point3D(empty.X - 20f, empty.Y, pointEx.zPosition + pointEx.depth)
            };
            area.matrix3D.TransformPoints(array);
            empty = array[0].PointF;
            if (num == 0 || num == 180)
            {
                array[0].PointF = graph.GetAbsolutePoint(array[0].PointF);
                array[1].PointF = graph.GetAbsolutePoint(array[1].PointF);
                float num2 = (float)Math.Atan((array[1].Y - array[0].Y) / (array[1].X - array[0].X));
                num2 = (float)Math.Round(num2 * 180f / (float)Math.PI);
                num += (int)num2;
            }
            SizeF labelSize = SizeF.Empty;

            if (ser.SmartLabels.Enabled)
            {
                labelSize = graph.GetRelativeSize(graph.MeasureString(text, dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                bool markerOverlapping = ser.SmartLabels.MarkerOverlapping;
                LabelAlignmentTypes movingDirection = ser.SmartLabels.MovingDirection;
                ser.SmartLabels.MarkerOverlapping = true;
                if (ser.SmartLabels.MovingDirection == (LabelAlignmentTypes.Top | LabelAlignmentTypes.Bottom | LabelAlignmentTypes.Right | LabelAlignmentTypes.Left | LabelAlignmentTypes.TopLeft | LabelAlignmentTypes.TopRight | LabelAlignmentTypes.BottomLeft | LabelAlignmentTypes.BottomRight))
                {
                    ser.SmartLabels.MovingDirection = (LabelAlignmentTypes.Right | LabelAlignmentTypes.Left);
                }
                empty = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, ser.SmartLabels, empty, labelSize, ref format, empty, new SizeF(0f, 0f), LabelAlignmentTypes.Center);
                ser.SmartLabels.MarkerOverlapping = markerOverlapping;
                ser.SmartLabels.MovingDirection   = movingDirection;
                num = 0;
            }
            if (!empty.IsEmpty)
            {
                if (labelSize.IsEmpty)
                {
                    labelSize = graph.GetRelativeSize(graph.MeasureString(text, dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                }
                RectangleF empty2 = RectangleF.Empty;
                SizeF      sizeF2 = new SizeF(labelSize.Width, labelSize.Height);
                sizeF2.Height += labelSize.Height / 8f;
                sizeF2.Width  += sizeF2.Width / (float)text.Length;
                graph.DrawPointLabelStringRel(backPosition: new RectangleF(empty.X - sizeF2.Width / 2f, empty.Y - sizeF2.Height / 2f - labelSize.Height / 10f, sizeF2.Width, sizeF2.Height), common: common, text: text, font: dataPoint.Font, brush: new SolidBrush(dataPoint.FontColor), position: empty, format: format, angle: num, backColor: dataPoint.LabelBackColor, borderColor: dataPoint.LabelBorderColor, borderWidth: dataPoint.LabelBorderWidth, borderStyle: dataPoint.LabelBorderStyle, series: ser, point: dataPoint, pointIndex: pointIndex);
            }
        }
        public void DrawLabels(CommonElements common, ChartGraphics graph, ChartArea area, DataPoint point, int pointIndex, Series series, RectangleF rectangle)
        {
            StringFormat format = new StringFormat();

            format.Alignment     = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;
            Region clip = graph.Clip;

            graph.Clip = new Region();
            if (point.ShowLabelAsValue || point.Label.Length > 0)
            {
                double value = GetYValue(common, area, series, point, pointIndex, 0);
                if (hundredPercentStacked && point.LabelFormat.Length == 0)
                {
                    value = Math.Round(value, 2);
                }
                string text;
                if (point.Label.Length == 0)
                {
                    text = ValueConverter.FormatValue(series.chart, point, value, point.LabelFormat, series.YValueType, ChartElementType.DataPoint);
                }
                else
                {
                    text = point.ReplaceKeywords(point.Label);
                    if (series.chart != null && series.chart.LocalizeTextHandler != null)
                    {
                        text = series.chart.LocalizeTextHandler(point, text, point.ElementId, ChartElementType.DataPoint);
                    }
                }
                PointF pointF = PointF.Empty;
                pointF.X = rectangle.X + rectangle.Width / 2f;
                pointF.Y = rectangle.Y + rectangle.Height / 2f;
                int angle = point.FontAngle;
                if (text.Trim().Length != 0)
                {
                    SizeF relativeSize = graph.GetRelativeSize(graph.MeasureString(text, point.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                    BarValueLabelDrawingStyle barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Center;
                    string text2 = "";
                    if (point.IsAttributeSet("BarLabelStyle"))
                    {
                        text2 = point["BarLabelStyle"];
                    }
                    else if (series.IsAttributeSet("BarLabelStyle"))
                    {
                        text2 = series["BarLabelStyle"];
                    }
                    if (text2 != null && text2.Length > 0)
                    {
                        if (string.Compare(text2, "Left", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Left;
                        }
                        else if (string.Compare(text2, "Right", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Right;
                        }
                        else if (string.Compare(text2, "Center", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Center;
                        }
                        else if (string.Compare(text2, "Outside", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            barValueLabelDrawingStyle = BarValueLabelDrawingStyle.Outside;
                        }
                    }
                    switch (barValueLabelDrawingStyle)
                    {
                    case BarValueLabelDrawingStyle.Left:
                        pointF.X = rectangle.X + relativeSize.Width / 2f;
                        break;

                    case BarValueLabelDrawingStyle.Right:
                        pointF.X = rectangle.Right - relativeSize.Width / 2f;
                        break;

                    case BarValueLabelDrawingStyle.Outside:
                        pointF.X = rectangle.Right + relativeSize.Width / 2f;
                        break;
                    }
                    if (series.SmartLabels.Enabled)
                    {
                        bool markerOverlapping = series.SmartLabels.MarkerOverlapping;
                        LabelAlignmentTypes movingDirection = series.SmartLabels.MovingDirection;
                        series.SmartLabels.MarkerOverlapping = true;
                        if (series.SmartLabels.MovingDirection == (LabelAlignmentTypes.Top | LabelAlignmentTypes.Bottom | LabelAlignmentTypes.Right | LabelAlignmentTypes.Left | LabelAlignmentTypes.TopLeft | LabelAlignmentTypes.TopRight | LabelAlignmentTypes.BottomLeft | LabelAlignmentTypes.BottomRight))
                        {
                            series.SmartLabels.MovingDirection = (LabelAlignmentTypes.Right | LabelAlignmentTypes.Left);
                        }
                        pointF = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, series.SmartLabels, pointF, relativeSize, ref format, pointF, new SizeF(0f, 0f), LabelAlignmentTypes.Center);
                        series.SmartLabels.MarkerOverlapping = markerOverlapping;
                        series.SmartLabels.MovingDirection   = movingDirection;
                        angle = 0;
                    }
                    if (!pointF.IsEmpty)
                    {
                        RectangleF empty = RectangleF.Empty;
                        SizeF      size  = new SizeF(relativeSize.Width, relativeSize.Height);
                        size.Height += relativeSize.Height / 8f;
                        size.Width  += size.Width / (float)text.Length;
                        empty        = new RectangleF(pointF.X - size.Width / 2f, pointF.Y - size.Height / 2f - relativeSize.Height / 10f, size.Width, size.Height);
                        empty        = area.smartLabels.GetLabelPosition(graph, pointF, size, format, adjustForDrawing: true);
                        graph.DrawPointLabelStringRel(common, text, point.Font, new SolidBrush(point.FontColor), pointF, format, angle, empty, point.LabelBackColor, point.LabelBorderColor, point.LabelBorderWidth, point.LabelBorderStyle, series, point, pointIndex);
                    }
                }
            }
            graph.Clip = clip;
        }