Exemplo n.º 1
0
        public DataPoint3D GetAxisIntersection(DataPoint3D firstPoint, DataPoint3D secondPoint, float axisPosition)
        {
            DataPoint3D dataPoint3D = new DataPoint3D();

            dataPoint3D.yPosition = (double)axisPosition;
            dataPoint3D.xPosition = ((double)axisPosition - firstPoint.yPosition) * (secondPoint.xPosition - firstPoint.xPosition) / (secondPoint.yPosition - firstPoint.yPosition) + firstPoint.xPosition;
            return(dataPoint3D);
        }
Exemplo n.º 2
0
 internal DataPoint3D GetAxisIntersection(DataPoint3D firstPoint, DataPoint3D secondPoint, float axisPosition)
 {
     return(new DataPoint3D
     {
         yPosition = axisPosition,
         xPosition = ((double)axisPosition - firstPoint.yPosition) * (secondPoint.xPosition - firstPoint.xPosition) / (secondPoint.yPosition - firstPoint.yPosition) + firstPoint.xPosition
     });
 }
        protected override void GetTopSurfaceVisibility(ChartArea area, DataPoint3D firstPoint, DataPoint3D secondPoint, bool upSideDown, float positionZ, float depth, Matrix3D matrix, ref SurfaceNames visibleSurfaces)
        {
            base.GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
            if ((visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top)
            {
                bool flag = false;
                foreach (Series item in area.Common.DataManager.Series)
                {
                    if (string.Compare(item.ChartTypeName, secondPoint.dataPoint.series.ChartTypeName, ignoreCase: true, CultureInfo.CurrentCulture) != 0)
                    {
                        continue;
                    }
                    if (flag)
                    {
                        DataPointAttributes dataPointAttributes = item.Points[secondPoint.index - 1];
                        if (item.Points[secondPoint.index - 1].Empty)
                        {
                            dataPointAttributes = item.EmptyPointStyle;
                        }
                        if (dataPointAttributes.Color.A == byte.MaxValue)
                        {
                            visibleSurfaces ^= SurfaceNames.Top;
                        }
                        break;
                    }
                    if (string.Compare(item.Name, secondPoint.dataPoint.series.Name, StringComparison.Ordinal) == 0)
                    {
                        flag = true;
                    }
                }
            }
            if ((visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom)
            {
                return;
            }
            DataPointAttributes dataPointAttributes2 = null;

            foreach (Series item2 in area.Common.DataManager.Series)
            {
                if (string.Compare(item2.ChartTypeName, secondPoint.dataPoint.series.ChartTypeName, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    continue;
                }
                if (dataPointAttributes2 != null && string.Compare(item2.Name, secondPoint.dataPoint.series.Name, StringComparison.Ordinal) == 0)
                {
                    if (dataPointAttributes2.Color.A != byte.MaxValue)
                    {
                        visibleSurfaces |= SurfaceNames.Bottom;
                    }
                    break;
                }
                dataPointAttributes2 = item2.Points[secondPoint.index - 1];
                if (item2.Points[secondPoint.index - 1].Empty)
                {
                    dataPointAttributes2 = item2.EmptyPointStyle;
                }
            }
        }
Exemplo n.º 4
0
        protected virtual void GetTopSurfaceVisibility(ChartArea area, DataPoint3D firstPoint, DataPoint3D secondPoint, bool upSideDown, float positionZ, float depth, Matrix3D matrix, ref SurfaceNames visibleSurfaces)
        {
            if ((visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top)
            {
                visibleSurfaces ^= SurfaceNames.Top;
            }
            Point3D[] array = new Point3D[3];
            if (!area.reverseSeriesOrder)
            {
                if (!upSideDown && firstPoint.xPosition <= secondPoint.xPosition)
                {
                    goto IL_0048;
                }
                if (upSideDown && firstPoint.xPosition >= secondPoint.xPosition)
                {
                    goto IL_0048;
                }
                array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
                array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
                array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
            }
            else
            {
                if (!upSideDown && secondPoint.xPosition <= firstPoint.xPosition)
                {
                    goto IL_010c;
                }
                if (upSideDown && secondPoint.xPosition >= firstPoint.xPosition)
                {
                    goto IL_010c;
                }
                array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
                array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
                array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
            }
            goto IL_01a4;
IL_010c:
            array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
            array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
            array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
            goto IL_01a4;
IL_01a4:
            matrix.TransformPoints(array);
            if (ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]))
            {
                visibleSurfaces |= SurfaceNames.Top;
            }
            return;

IL_0048:
            array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
            array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
            array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
            goto IL_01a4;
        }
        protected override void ProcessSinglePoint3D(DataPoint3D pointEx, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, RectangleF columnPosition, int pointIndex)
        {
            DataPoint dataPoint = pointEx.dataPoint;

            if (dataPoint.YValues.Length < this.YValuesPerPoint)
            {
                throw new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(this.Name, this.YValuesPerPoint.ToString(CultureInfo.InvariantCulture)));
            }
            StringFormat stringFormat = new StringFormat();

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

            graph.Clip = new Region();
            if (dataPoint.ShowLabelAsValue || dataPoint.Label.Length > 0)
            {
                string text;
                if (dataPoint.Label.Length == 0)
                {
                    double yValue = this.GetYValue(common, area, pointEx.dataPoint.series, dataPoint, pointEx.index - 1, 0);
                    text = ValueConverter.FormatValue(pointEx.dataPoint.series.chart, dataPoint, yValue, dataPoint.LabelFormat, pointEx.dataPoint.series.YValueType, ChartElementType.DataPoint);
                }
                else
                {
                    text = dataPoint.ReplaceKeywords(dataPoint.Label);
                    if (pointEx.dataPoint.series.chart != null && pointEx.dataPoint.series.chart.LocalizeTextHandler != null)
                    {
                        text = pointEx.dataPoint.series.chart.LocalizeTextHandler(dataPoint, text, dataPoint.ElementId, ChartElementType.DataPoint);
                    }
                }
                PointF empty = PointF.Empty;
                empty.X = (float)(columnPosition.X + columnPosition.Width / 2.0);
                empty.Y = (float)(columnPosition.Y + columnPosition.Height / 2.0);
                Point3D[] array = new Point3D[1]
                {
                    new Point3D(empty.X, empty.Y, pointEx.zPosition + pointEx.depth)
                };
                area.matrix3D.TransformPoints(array);
                empty.X = array[0].X;
                empty.Y = array[0].Y;
                graph.StartHotRegion(dataPoint, true);
                SizeF      relativeSize = graph.GetRelativeSize(graph.MeasureString(text, dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                RectangleF empty2       = RectangleF.Empty;
                SizeF      size         = new SizeF(relativeSize.Width, relativeSize.Height);
                size.Width  += size.Width / (float)text.Length;
                size.Height += (float)(relativeSize.Height / 8.0);
                empty2       = PointChart.GetLabelPosition(graph, empty, size, stringFormat, true);
                graph.DrawPointLabelStringRel(common, text, dataPoint.Font, new SolidBrush(dataPoint.FontColor), empty, stringFormat, dataPoint.FontAngle, empty2, dataPoint.LabelBackColor, dataPoint.LabelBorderColor, dataPoint.LabelBorderWidth, dataPoint.LabelBorderStyle, dataPoint.series, dataPoint, pointIndex);
                graph.EndHotRegion();
            }
            graph.Clip = clip;
        }
Exemplo n.º 6
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            if (pointLoopIndex != 2)
            {
                return(base.Draw3DSurface(area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, topDarkening, bottomDarkening, thirdPointPosition, fourthPointPosition, clippedSegment));
            }
            DataPoint3D dataPoint3D = (DataPoint3D)points[pointIndex];

            if (dataPoint3D.index == 2)
            {
                int         num     = 0;
                DataPoint3D pointEx = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, dataPoint3D, ref num);
                this.DrawLabels3D(area, graph, area.Common, pointEx, positionZ, depth);
            }
            this.DrawLabels3D(area, graph, area.Common, dataPoint3D, positionZ, depth);
            return(new GraphicsPath());
        }
Exemplo n.º 7
0
        protected override int GetPointLoopNumber(bool selection, ArrayList pointsArray)
        {
            if (selection)
            {
                return(1);
            }
            int result = 1;

            foreach (object item in pointsArray)
            {
                DataPoint3D dataPoint3D = (DataPoint3D)item;
                if (dataPoint3D.dataPoint.Color.A != 255)
                {
                    result = 2;
                }
            }
            return(result);
        }
Exemplo n.º 8
0
        protected override int GetPointLoopNumber(bool selection, ArrayList pointsArray)
        {
            if (selection)
            {
                return(1);
            }
            int result = 1;

            foreach (object item in pointsArray)
            {
                DataPoint3D dataPoint3D = (DataPoint3D)item;
                if (dataPoint3D.dataPoint.Color.A != 255)
                {
                    result = 2;
                }
                if (dataPoint3D.dataPoint.Label.Length > 0 || dataPoint3D.dataPoint.ShowLabelAsValue || dataPoint3D.dataPoint.series.ShowLabelAsValue)
                {
                    return(3);
                }
            }
            return(result);
        }
Exemplo n.º 9
0
        internal GraphicsPath Draw3DSplinePolygon(ChartGraphics graph, ChartArea area, float positionZ, Color backColor, Color borderColor, int borderWidth, ChartDashStyle borderStyle, DataPoint3D firstPoint, DataPoint3D secondPoint, DataPoint3D thirdPoint, DataPoint3D fourthPoint, ArrayList points, int pointIndex, float tension, DrawingOperationTypes operationType, LineSegmentType lineSegmentType, bool forceThinBorder)
        {
            if (tension == 0f)
            {
                SurfaceNames thinBorders = (SurfaceNames)0;
                if (forceThinBorder)
                {
                    thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                }
                return(graph.Draw3DPolygon(area, area.matrix3D, area.Area3DStyle.Light, SurfaceNames.Front, positionZ, backColor, borderColor, borderWidth, borderStyle, firstPoint, secondPoint, thirdPoint, fourthPoint, points, pointIndex, tension, operationType, lineSegmentType, thinBorders));
            }
            bool         num                = (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement;
            GraphicsPath graphicsPath       = new GraphicsPath();
            GraphicsPath splineFlattenPath  = graph.GetSplineFlattenPath(area, area.matrix3D, positionZ, 0f, firstPoint, secondPoint, points, pointIndex, tension, flatten: false, translateCoordinates: true, 0);
            GraphicsPath splineFlattenPath2 = graph.GetSplineFlattenPath(area, area.matrix3D, positionZ, 0f, thirdPoint, fourthPoint, points, pointIndex, tension, flatten: false, translateCoordinates: true, 1);

            graphicsPath.AddPath(splineFlattenPath, connect: true);
            graphicsPath.AddPath(splineFlattenPath2, connect: true);
            graphicsPath.CloseAllFigures();
            Point3D[] array = new Point3D[3]
            {
                new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ),
                new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ),
                new Point3D((float)thirdPoint.xPosition, (float)thirdPoint.yPosition, positionZ)
            };
            area.matrix3D.TransformPoints(array);
            bool  visiblePolygon = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
            Color polygonLight   = area.matrix3D.GetPolygonLight(array, backColor, visiblePolygon, area.Area3DStyle.YAngle, SurfaceNames.Front, area.reverseSeriesOrder);
            Color color          = borderColor;

            if (color == Color.Empty)
            {
                color = ChartGraphics.GetGradientColor(backColor, Color.Black, 0.2);
            }
            Pen pen = null;

            if (num)
            {
                SmoothingMode smoothingMode = graph.SmoothingMode;
                graph.SmoothingMode = SmoothingMode.Default;
                graph.FillPath(new SolidBrush(polygonLight), graphicsPath);
                graph.SmoothingMode = smoothingMode;
                if (forceThinBorder)
                {
                    graph.DrawPath(new Pen(color, 1f), graphicsPath);
                }
                else if (polygonLight.A == byte.MaxValue)
                {
                    graph.DrawPath(new Pen(polygonLight, 1f), graphicsPath);
                }
                pen          = new Pen(color, borderWidth);
                pen.StartCap = LineCap.Round;
                pen.EndCap   = LineCap.Round;
                graph.DrawPath(pen, splineFlattenPath);
                graph.DrawPath(pen, splineFlattenPath2);
                switch (lineSegmentType)
                {
                case LineSegmentType.First:
                    graph.DrawLine(pen, splineFlattenPath.PathPoints[0], splineFlattenPath2.GetLastPoint());
                    break;

                case LineSegmentType.Last:
                    graph.DrawLine(pen, splineFlattenPath.GetLastPoint(), splineFlattenPath2.PathPoints[0]);
                    break;
                }
            }
            if (graphicsPath != null && pen != null)
            {
                ChartGraphics.Widen(graphicsPath, pen);
            }
            return(graphicsPath);
        }
        private void ProcessChartType3D(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, bool labels, Series seriesToDraw)
        {
            if (labels && !selection)
            {
                return;
            }
            ArrayList arrayList = null;

            arrayList = area.GetClusterSeriesNames(seriesToDraw.Name);
            common.DataManager.GetNumberOfPoints((string[])arrayList.ToArray(typeof(string)));
            ArrayList dataPointDrawingOrder = area.GetDataPointDrawingOrder(arrayList, this, selection, COPCoordinates.X | COPCoordinates.Y, null, 0, false);
            bool      flag = false;

            foreach (object item in dataPointDrawingOrder)
            {
                DataPoint3D dataPoint3D = (DataPoint3D)item;
                DataPoint   dataPoint   = dataPoint3D.dataPoint;
                Series      series      = dataPoint.series;
                this.currentStackGroup = StackedColumnChart.GetSeriesStackGroupName(series);
                dataPoint.positionRel  = new PointF(float.NaN, float.NaN);
                Axis            axis            = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName);
                Axis            axis2           = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName);
                BarDrawingStyle barDrawingStyle = ChartGraphics.GetBarDrawingStyle(dataPoint);
                float           num             = 0.5f;
                float           num2            = 0.5f;
                bool            flag2           = true;
                bool            flag3           = false;
                for (int i = 0; i < arrayList.Count; i++)
                {
                    Series series2 = common.DataManager.Series[i];
                    if (flag2 && dataPoint3D.index <= series2.Points.Count && series2.Points[dataPoint3D.index - 1].YValues[0] != 0.0)
                    {
                        flag2 = false;
                        if (series2.Name == series.Name)
                        {
                            num2 = 0f;
                        }
                    }
                    if (series2.Name == series.Name)
                    {
                        flag3 = true;
                    }
                    else if (dataPoint3D.index <= series2.Points.Count && series2.Points[dataPoint3D.index - 1].YValues[0] != 0.0)
                    {
                        flag3 = false;
                    }
                }
                if (flag3)
                {
                    num = 0f;
                }
                if (area.stackGroupNames != null && area.stackGroupNames.Count > 1 && area.Area3DStyle.Clustered)
                {
                    string seriesStackGroupName = StackedColumnChart.GetSeriesStackGroupName(series);
                    bool   flag4 = true;
                    bool   flag5 = false;
                    foreach (string item2 in arrayList)
                    {
                        Series series3 = common.DataManager.Series[item2];
                        if (StackedColumnChart.GetSeriesStackGroupName(series3) == seriesStackGroupName)
                        {
                            if (flag4 && dataPoint3D.index < series3.Points.Count && series3.Points[dataPoint3D.index - 1].YValues[0] != 0.0)
                            {
                                flag4 = false;
                                if (item2 == series.Name)
                                {
                                    num2 = 0f;
                                }
                            }
                            if (item2 == series.Name)
                            {
                                flag5 = true;
                            }
                            else if (dataPoint3D.index < series3.Points.Count && series3.Points[dataPoint3D.index - 1].YValues[0] != 0.0)
                            {
                                flag5 = false;
                            }
                        }
                    }
                    if (flag5)
                    {
                        num = 0f;
                    }
                }
                double yValue  = this.GetYValue(common, area, series, dataPoint3D.dataPoint, dataPoint3D.index - 1, 0);
                double yValue2 = yValue - this.GetYValue(common, area, series, dataPoint3D.dataPoint, dataPoint3D.index - 1, -1);
                yValue  = axis.GetLogValue(yValue);
                yValue2 = axis.GetLogValue(yValue2);
                if (yValue2 > axis.GetViewMaximum())
                {
                    num     = 0.5f;
                    yValue2 = axis.GetViewMaximum();
                }
                else if (yValue2 < axis.GetViewMinimum())
                {
                    num2    = 0.5f;
                    yValue2 = axis.GetViewMinimum();
                }
                if (yValue > axis.GetViewMaximum())
                {
                    num    = 0.5f;
                    yValue = axis.GetViewMaximum();
                }
                else if (yValue < axis.GetViewMinimum())
                {
                    num2   = 0.5f;
                    yValue = axis.GetViewMinimum();
                }
                double     linearPosition  = axis.GetLinearPosition(yValue);
                double     linearPosition2 = axis.GetLinearPosition(yValue2);
                RectangleF empty           = RectangleF.Empty;
                try
                {
                    empty.X     = (float)(dataPoint3D.xPosition - dataPoint3D.width / 2.0);
                    empty.Width = (float)dataPoint3D.width;
                    if (linearPosition2 < linearPosition)
                    {
                        float num3 = num2;
                        num2         = num;
                        num          = num3;
                        empty.Y      = (float)linearPosition2;
                        empty.Height = (float)linearPosition - empty.Y;
                    }
                    else
                    {
                        empty.Y      = (float)linearPosition;
                        empty.Height = (float)linearPosition2 - empty.Y;
                    }
                }
                catch (Exception)
                {
                    continue;
                }
                dataPoint.positionRel = new PointF((float)dataPoint3D.xPosition, empty.Top);
                if (!dataPoint.Empty)
                {
                    double yValue3 = dataPoint3D.indexedSeries ? ((double)dataPoint3D.index) : dataPoint.XValue;
                    yValue3 = axis2.GetLogValue(yValue3);
                    if (!(yValue3 < axis2.GetViewMinimum()) && !(yValue3 > axis2.GetViewMaximum()) && (!(yValue < axis.GetViewMinimum()) || !(yValue2 < axis.GetViewMinimum())) && (!(yValue > axis.GetViewMaximum()) || !(yValue2 > axis.GetViewMaximum())))
                    {
                        bool flag6 = false;
                        if (!(empty.Right <= area.PlotAreaPosition.X) && !(empty.X >= area.PlotAreaPosition.Right()))
                        {
                            if (empty.X < area.PlotAreaPosition.X)
                            {
                                empty.Width -= area.PlotAreaPosition.X - empty.X;
                                empty.X      = area.PlotAreaPosition.X;
                            }
                            if (empty.Right > area.PlotAreaPosition.Right())
                            {
                                empty.Width -= empty.Right - area.PlotAreaPosition.Right();
                            }
                            if (empty.Width < 0.0)
                            {
                                empty.Width = 0f;
                            }
                            if (empty.Height != 0.0 && empty.Width != 0.0)
                            {
                                DrawingOperationTypes drawingOperationTypes = DrawingOperationTypes.DrawElement;
                                if (common.ProcessModeRegions)
                                {
                                    drawingOperationTypes |= DrawingOperationTypes.CalcElementPath;
                                }
                                graph.StartHotRegion(dataPoint);
                                GraphicsPath path = graph.Fill3DRectangle(empty, dataPoint3D.zPosition, dataPoint3D.depth, area.matrix3D, area.Area3DStyle.Light, dataPoint.Color, num, num2, dataPoint.BackHatchStyle, dataPoint.BackImage, dataPoint.BackImageMode, dataPoint.BackImageTransparentColor, dataPoint.BackImageAlign, dataPoint.BackGradientType, dataPoint.BackGradientEndColor, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderStyle, PenAlignment.Inset, barDrawingStyle, true, drawingOperationTypes);
                                graph.StopAnimation();
                                graph.EndHotRegion();
                                if (flag6)
                                {
                                    graph.ResetClip();
                                }
                                if (common.ProcessModeRegions && !labels)
                                {
                                    common.HotRegionsList.AddHotRegion(path, false, graph, dataPoint, series.Name, dataPoint3D.index - 1);
                                }
                                if (dataPoint.ShowLabelAsValue || dataPoint.Label.Length > 0)
                                {
                                    flag = true;
                                }
                            }
                        }
                    }
                }
            }
            if (flag)
            {
                foreach (object item3 in dataPointDrawingOrder)
                {
                    DataPoint3D dataPoint3D2 = (DataPoint3D)item3;
                    DataPoint   dataPoint2   = dataPoint3D2.dataPoint;
                    Series      series4      = dataPoint2.series;
                    Axis        axis3        = area.GetAxis(AxisName.Y, series4.YAxisType, series4.YSubAxisName);
                    Axis        axis4        = area.GetAxis(AxisName.X, series4.XAxisType, series4.XSubAxisName);
                    double      num4         = this.GetYValue(common, area, series4, dataPoint3D2.dataPoint, dataPoint3D2.index - 1, 0);
                    if (num4 > axis3.GetViewMaximum())
                    {
                        num4 = axis3.GetViewMaximum();
                    }
                    if (num4 < axis3.GetViewMinimum())
                    {
                        num4 = axis3.GetViewMinimum();
                    }
                    num4 = axis3.GetLogValue(num4);
                    double     yPosition = dataPoint3D2.yPosition;
                    double     num5      = num4 - axis3.GetLogValue(this.GetYValue(common, area, series4, dataPoint3D2.dataPoint, dataPoint3D2.index - 1, -1));
                    double     height    = dataPoint3D2.height;
                    RectangleF empty2    = RectangleF.Empty;
                    try
                    {
                        empty2.X     = (float)(dataPoint3D2.xPosition - dataPoint3D2.width / 2.0);
                        empty2.Width = (float)dataPoint3D2.width;
                        if (height < yPosition)
                        {
                            empty2.Y      = (float)height;
                            empty2.Height = (float)yPosition - empty2.Y;
                        }
                        else
                        {
                            empty2.Y      = (float)yPosition;
                            empty2.Height = (float)height - empty2.Y;
                        }
                    }
                    catch (Exception)
                    {
                        continue;
                    }
                    if (!dataPoint2.Empty && !selection)
                    {
                        double yValue4 = dataPoint3D2.indexedSeries ? ((double)dataPoint3D2.index) : dataPoint2.XValue;
                        yValue4 = axis4.GetLogValue(yValue4);
                        if (!(yValue4 < axis4.GetViewMinimum()) && !(yValue4 > axis4.GetViewMaximum()) && (!(num4 < axis3.GetViewMinimum()) || !(num5 < axis3.GetViewMinimum())) && (!(num4 > axis3.GetViewMaximum()) || !(num5 > axis3.GetViewMaximum())))
                        {
                            graph.StartAnimation();
                            this.DrawLabels3D(common, graph, area, dataPoint3D2, dataPoint3D2.index - 1, series4, empty2);
                            graph.StopAnimation();
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
        protected override void GetBottomPointsPosition(CommonElements common, ChartArea area, float axisPosition, ref DataPoint3D firstPoint, ref DataPoint3D secondPoint, PointF thirdPointPosition, PointF fourthPointPosition, out PointF thirdPoint, out PointF fourthPoint)
        {
            Axis   axis   = area.GetAxis(AxisName.Y, firstPoint.dataPoint.series.YAxisType, firstPoint.dataPoint.series.YSubAxisName);
            Axis   axis2  = area.GetAxis(AxisName.X, firstPoint.dataPoint.series.XAxisType, firstPoint.dataPoint.series.XSubAxisName);
            double yValue = this.GetYValue(area.Common, area, firstPoint.dataPoint.series, firstPoint.dataPoint, firstPoint.index - 1, 0);
            double num    = (double)(float)firstPoint.xPosition;

            if (yValue >= 0.0)
            {
                if (double.IsNaN(this.prevPosY))
                {
                    yValue = (double)axisPosition;
                }
                else
                {
                    yValue = axis.GetPosition(this.prevPosY);
                    num    = axis2.GetPosition(this.prevPositionX);
                }
            }
            else if (double.IsNaN(this.prevNegY))
            {
                yValue = (double)axisPosition;
            }
            else
            {
                yValue = axis.GetPosition(this.prevNegY);
                num    = axis2.GetPosition(this.prevPositionX);
            }
            thirdPoint = new PointF((float)num, (float)yValue);
            yValue     = this.GetYValue(area.Common, area, secondPoint.dataPoint.series, secondPoint.dataPoint, secondPoint.index - 1, 0);
            num        = (double)(float)secondPoint.xPosition;
            if (yValue >= 0.0)
            {
                if (double.IsNaN(this.prevPosY))
                {
                    yValue = (double)axisPosition;
                }
                else
                {
                    yValue = axis.GetPosition(this.prevPosY);
                    num    = axis2.GetPosition(this.prevPositionX);
                }
            }
            else if (double.IsNaN(this.prevNegY))
            {
                yValue = (double)axisPosition;
            }
            else
            {
                yValue = axis.GetPosition(this.prevNegY);
                num    = axis2.GetPosition(this.prevPositionX);
            }
            fourthPoint = new PointF((float)num, (float)yValue);
            if (!float.IsNaN(thirdPointPosition.X))
            {
                thirdPoint.X = (float)((firstPoint.xCenterVal == 0.0) ? firstPoint.xPosition : firstPoint.xCenterVal);
                thirdPoint.Y = (thirdPointPosition.X - fourthPoint.X) / (thirdPoint.X - fourthPoint.X) * (thirdPoint.Y - fourthPoint.Y) + fourthPoint.Y;
                thirdPoint.X = thirdPointPosition.X;
            }
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                thirdPoint.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.X))
            {
                fourthPoint.X = (float)((secondPoint.xCenterVal == 0.0) ? secondPoint.xPosition : secondPoint.xCenterVal);
                fourthPoint.Y = (fourthPointPosition.X - fourthPoint.X) / (thirdPoint.X - fourthPoint.X) * (thirdPoint.Y - fourthPoint.Y) + fourthPoint.Y;
                fourthPoint.X = fourthPointPosition.X;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                fourthPoint.Y = fourthPointPosition.Y;
            }
        }
Exemplo n.º 12
0
        private void ProcessChartType3D(bool labels, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw)
        {
            if (labels && !selection)
            {
                return;
            }
            SizeF     relativeSize = graph.GetRelativeSize(new SizeF(1.1f, 1.1f));
            ArrayList arrayList    = null;
            bool      flag         = this.drawSeriesSideBySide;

            if (area.Area3DStyle.Clustered && this.SideBySideSeries)
            {
                goto IL_0047;
            }
            if (this.Stacked)
            {
                goto IL_0047;
            }
            arrayList = new ArrayList();
            arrayList.Add(seriesToDraw.Name);
            goto IL_0122;
IL_0047:
            arrayList = area.GetSeriesFromChartType(this.Name);
            foreach (string item in arrayList)
            {
                if (common.DataManager.Series[item].IsAttributeSet("DrawSideBySide"))
                {
                    string strA = ((DataPointAttributes)common.DataManager.Series[item])["DrawSideBySide"];
                    if (string.Compare(strA, "False", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        flag = false;
                    }
                    else if (string.Compare(strA, "True", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        flag = true;
                    }
                    else if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        throw new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid);
                    }
                }
            }
            goto IL_0122;
IL_0122:
            ArrayList dataPointDrawingOrder = area.GetDataPointDrawingOrder(arrayList, this, selection, this.coordinates, null, base.yValueIndex, flag);

            foreach (object item2 in dataPointDrawingOrder)
            {
                DataPoint3D     dataPoint3D     = (DataPoint3D)item2;
                DataPoint       dataPoint       = dataPoint3D.dataPoint;
                Series          series          = dataPoint.series;
                BarDrawingStyle barDrawingStyle = ChartGraphics.GetBarDrawingStyle(dataPoint);
                Axis            axis            = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName);
                Axis            axis2           = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName);
                float           num             = 0f;
                float           num2            = 0f;
                double          yValue          = this.GetYValue(common, area, series, dataPoint3D.dataPoint, dataPoint3D.index - 1, this.useTwoValues ? 1 : 0);
                yValue = axis.GetLogValue(yValue);
                if (yValue > axis.GetViewMaximum())
                {
                    num    = 0.5f;
                    yValue = axis.GetViewMaximum();
                }
                if (yValue < axis.GetViewMinimum())
                {
                    num    = 0.5f;
                    yValue = axis.GetViewMinimum();
                }
                double num3 = axis.GetLinearPosition(yValue);
                double num4 = 0.0;
                if (this.useTwoValues)
                {
                    double num5 = axis.GetLogValue(this.GetYValue(common, area, series, dataPoint, dataPoint3D.index - 1, 0));
                    if (num5 > axis.GetViewMaximum())
                    {
                        num2 = 0.5f;
                        num5 = axis.GetViewMaximum();
                    }
                    else if (num5 < axis.GetViewMinimum())
                    {
                        num2 = 0.5f;
                        num5 = axis.GetViewMinimum();
                    }
                    num4 = axis.GetLinearPosition(num5);
                }
                else
                {
                    num4 = axis.GetPosition(axis.Crossing);
                }
                if (!flag)
                {
                    dataPoint3D.xPosition = dataPoint3D.xCenterVal;
                }
                this.ShiftedX = dataPoint3D.xPosition - dataPoint3D.xCenterVal;
                if (num3 < num4 && num4 - num3 < (double)relativeSize.Height)
                {
                    num3 = num4 - (double)relativeSize.Height;
                }
                if (num3 > num4 && num3 - num4 < (double)relativeSize.Height)
                {
                    num3 = num4 + (double)relativeSize.Height;
                }
                RectangleF empty = RectangleF.Empty;
                try
                {
                    empty.X     = (float)(dataPoint3D.xPosition - dataPoint3D.width / 2.0);
                    empty.Width = (float)dataPoint3D.width;
                    if (num4 < num3)
                    {
                        float num6 = num2;
                        num2         = num;
                        num          = num6;
                        empty.Y      = (float)num4;
                        empty.Height = (float)num3 - empty.Y;
                    }
                    else
                    {
                        empty.Y      = (float)num3;
                        empty.Height = (float)num4 - empty.Y;
                    }
                }
                catch (Exception)
                {
                    continue;
                }
                GraphicsPath graphicsPath = null;
                double       yValue2      = dataPoint3D.indexedSeries ? ((double)dataPoint3D.index) : dataPoint.XValue;
                yValue2 = axis2.GetLogValue(yValue2);
                if (!(yValue2 < axis2.GetViewMinimum()) && !(yValue2 > axis2.GetViewMaximum()))
                {
                    bool flag2 = false;
                    if (!(empty.Right <= area.PlotAreaPosition.X) && !(empty.X >= area.PlotAreaPosition.Right()))
                    {
                        if (empty.X < area.PlotAreaPosition.X)
                        {
                            empty.Width -= area.PlotAreaPosition.X - empty.X;
                            empty.X      = area.PlotAreaPosition.X;
                        }
                        if (empty.Right > area.PlotAreaPosition.Right())
                        {
                            empty.Width -= empty.Right - area.PlotAreaPosition.Right();
                        }
                        if (empty.Width < 0.0)
                        {
                            empty.Width = 0f;
                        }
                        DrawingOperationTypes drawingOperationTypes = DrawingOperationTypes.DrawElement;
                        if (common.ProcessModeRegions)
                        {
                            drawingOperationTypes |= DrawingOperationTypes.CalcElementPath;
                        }
                        if (!dataPoint.Empty && empty.Height > 0.0 && empty.Width > 0.0)
                        {
                            graph.StartHotRegion(dataPoint);
                            this.Init3DAnimation(common, empty, dataPoint3D.zPosition, dataPoint3D.depth, area.matrix3D, graph, yValue < axis2.Crossing, dataPoint);
                            graph.StartAnimation();
                            graphicsPath = graph.Fill3DRectangle(empty, dataPoint3D.zPosition, dataPoint3D.depth, area.matrix3D, area.Area3DStyle.Light, dataPoint.Color, num, num2, dataPoint.BackHatchStyle, dataPoint.BackImage, dataPoint.BackImageMode, dataPoint.BackImageTransparentColor, dataPoint.BackImageAlign, dataPoint.BackGradientType, dataPoint.BackGradientEndColor, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderStyle, PenAlignment.Inset, barDrawingStyle, true, drawingOperationTypes);
                            graph.StopAnimation();
                            graph.EndHotRegion();
                            if (common.ProcessModeRegions && !labels)
                            {
                                common.HotRegionsList.AddHotRegion(graphicsPath, false, graph, dataPoint, series.Name, dataPoint3D.index - 1);
                            }
                        }
                        if (flag2)
                        {
                            graph.ResetClip();
                        }
                        this.ProcessSinglePoint3D(dataPoint3D, selection, graph, common, area, empty, dataPoint3D.index - 1);
                    }
                }
            }
            base.DrawAccumulated3DLabels(graph, common, area);
        }
Exemplo n.º 13
0
        public int Compare(object o1, object o2)
        {
            DataPoint3D dataPoint3D  = (DataPoint3D)o1;
            DataPoint3D dataPoint3D2 = (DataPoint3D)o2;
            int         num          = 0;

            if (dataPoint3D.xPosition < dataPoint3D2.xPosition)
            {
                num = -1;
            }
            else if (dataPoint3D.xPosition > dataPoint3D2.xPosition)
            {
                num = 1;
            }
            else
            {
                if (dataPoint3D.yPosition < dataPoint3D2.yPosition)
                {
                    num = 1;
                }
                else if (dataPoint3D.yPosition > dataPoint3D2.yPosition)
                {
                    num = -1;
                }
                if (!float.IsNaN(this.areaProjectionCenter.Y))
                {
                    double num2 = Math.Min(dataPoint3D.yPosition, dataPoint3D.height);
                    double num3 = Math.Max(dataPoint3D.yPosition, dataPoint3D.height);
                    double num4 = Math.Min(dataPoint3D2.yPosition, dataPoint3D2.height);
                    double num5 = Math.Max(dataPoint3D2.yPosition, dataPoint3D2.height);
                    if (this.area.IsBottomSceneWallVisible())
                    {
                        if (num2 <= (double)this.areaProjectionCenter.Y && num4 <= (double)this.areaProjectionCenter.Y)
                        {
                            num *= -1;
                        }
                        else if (num2 <= (double)this.areaProjectionCenter.Y)
                        {
                            num = 1;
                        }
                    }
                    else
                    {
                        num = ((!(num3 >= (double)this.areaProjectionCenter.Y) || !(num5 >= (double)this.areaProjectionCenter.Y)) ? ((num3 >= (double)this.areaProjectionCenter.Y) ? 1 : (num * -1)) : num);
                    }
                }
                else if (!this.area.DrawPointsInReverseOrder())
                {
                    num *= -1;
                }
            }
            if (dataPoint3D.xPosition != dataPoint3D2.xPosition)
            {
                if (!float.IsNaN(this.areaProjectionCenter.X))
                {
                    if (dataPoint3D.xPosition + dataPoint3D.width / 2.0 >= (double)this.areaProjectionCenter.X && dataPoint3D2.xPosition + dataPoint3D2.width / 2.0 >= (double)this.areaProjectionCenter.X)
                    {
                        num *= -1;
                    }
                }
                else if (this.area.IsBottomSceneWallVisible())
                {
                    num *= -1;
                }
            }
            if (!this.selection)
            {
                return(num);
            }
            return(-num);
        }
Exemplo n.º 14
0
        protected override GraphicsPath Draw3DSurface(DataPoint3D firstPoint, DataPoint3D secondPoint, bool reversed, ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, LineSegmentType surfaceSegmentType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment, bool clipOnTop, bool clipOnBottom)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            DataPoint3D dataPoint3D = secondPoint;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                dataPoint3D = firstPoint;
            }
            Color          color       = base.useBorderColor ? dataPoint3D.dataPoint.BorderColor : dataPoint3D.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D.dataPoint.BorderStyle;

            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            float num  = (float)Math.Round(base.vAxis.GetPosition(base.vAxis.Crossing), 3);
            float num2 = (float)Math.Min(firstPoint.xPosition, secondPoint.xPosition);
            float val  = (float)Math.Min(firstPoint.yPosition, secondPoint.yPosition);

            val = Math.Min(val, num);
            float num3 = (float)Math.Max(firstPoint.xPosition, secondPoint.xPosition);
            float val2 = (float)Math.Max(firstPoint.yPosition, secondPoint.yPosition);

            val2 = Math.Max(val2, num);
            RectangleF   position     = new RectangleF(num2, val, num3 - num2, val2 - val);
            SurfaceNames surfaceNames = graph.GetVisibleSurfaces(position, positionZ, depth, matrix);
            bool         upSideDown   = false;

            if ((decimal)firstPoint.yPosition >= (decimal)num && (decimal)secondPoint.yPosition >= (decimal)num)
            {
                upSideDown = true;
                bool flag  = (surfaceNames & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag2 = (surfaceNames & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                surfaceNames ^= SurfaceNames.Bottom;
                surfaceNames ^= SurfaceNames.Top;
                if (flag)
                {
                    surfaceNames |= SurfaceNames.Bottom;
                }
                if (flag2)
                {
                    surfaceNames |= SurfaceNames.Top;
                }
            }
            this.GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref surfaceNames);
            PointF pointF  = default(PointF);
            PointF pointF2 = default(PointF);

            this.GetBottomPointsPosition(base.common, area, num, ref firstPoint, ref secondPoint, thirdPointPosition, fourthPointPosition, out pointF, out pointF2);
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                pointF.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                pointF2.Y = fourthPointPosition.Y;
            }
            if (!float.IsNaN(pointF.X) && !float.IsNaN(pointF.Y) && !float.IsNaN(pointF2.X) && !float.IsNaN(pointF2.Y))
            {
                if (clipOnTop && base.ClipTopPoints(graphicsPath, ref firstPoint, ref secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
                {
                    return(graphicsPath);
                }
                if (clipOnBottom && base.ClipBottomPoints(graphicsPath, ref firstPoint, ref secondPoint, ref pointF, ref pointF2, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
                {
                    return(graphicsPath);
                }
                if (Math.Round((decimal)firstPoint.yPosition, 3) > (decimal)num + 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) < (decimal)num - 0.001m)
                {
                    goto IL_03d1;
                }
                if (Math.Round((decimal)firstPoint.yPosition, 3) < (decimal)num - 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) > (decimal)num + 0.001m)
                {
                    goto IL_03d1;
                }
                if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
                {
                    return(graphicsPath);
                }
                for (int i = 1; i <= 2; i++)
                {
                    SurfaceNames[] array = new SurfaceNames[6]
                    {
                        SurfaceNames.Back,
                        SurfaceNames.Bottom,
                        SurfaceNames.Top,
                        SurfaceNames.Left,
                        SurfaceNames.Right,
                        SurfaceNames.Front
                    };
                    LineSegmentType lineSegmentType = LineSegmentType.Middle;
                    SurfaceNames[]  array2          = array;
                    foreach (SurfaceNames surfaceNames2 in array2)
                    {
                        if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames2, surfaceNames, color, points, firstPoint, secondPoint, base.multiSeries, reversed, ref lineSegmentType) == i)
                        {
                            if (base.allPointsLoopsNumber == 2 && (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement)
                            {
                                if (pointLoopIndex == 0 && (surfaceNames2 == SurfaceNames.Front || (i == 2 && (surfaceNames2 == SurfaceNames.Left || surfaceNames2 == SurfaceNames.Right))))
                                {
                                    continue;
                                }
                                if (pointLoopIndex == 1)
                                {
                                    switch (surfaceNames2)
                                    {
                                    case SurfaceNames.Front:
                                        goto IL_05fc;
                                    }
                                    if (i != 1 && (surfaceNames2 == SurfaceNames.Left || surfaceNames2 == SurfaceNames.Right))
                                    {
                                        goto IL_05fc;
                                    }
                                    continue;
                                }
                            }
                            goto IL_05fc;
                        }
                        continue;
IL_05fc:
                        Color color2 = color;
                        Color color3 = dataPoint3D.dataPoint.BorderColor;
                        if (i == 1)
                        {
                            if (color2.A == 255)
                            {
                                continue;
                            }
                            color2 = Color.Transparent;
                            if (color3 == Color.Empty)
                            {
                                color3 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                            }
                        }
                        bool flag3 = base.showPointLines;
                        if (surfaceSegmentType == LineSegmentType.Middle)
                        {
                            flag3 = false;
                        }
                        if (!clippedSegment || surfaceNames2 == SurfaceNames.Top || surfaceNames2 == SurfaceNames.Bottom)
                        {
                            GraphicsPath graphicsPath2 = null;
                            switch (surfaceNames2)
                            {
                            case SurfaceNames.Top:
                            {
                                Color backColor   = (topDarkening == 0.0) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, (double)topDarkening);
                                Color borderColor = (topDarkening == 0.0) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, (double)topDarkening);
                                graphicsPath2 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, backColor, borderColor, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, 0f, operationType, surfaceSegmentType, flag3, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Bottom:
                            {
                                DataPoint3D dataPoint3D9 = new DataPoint3D();
                                dataPoint3D9.index     = firstPoint.index;
                                dataPoint3D9.dataPoint = firstPoint.dataPoint;
                                dataPoint3D9.xPosition = firstPoint.xPosition;
                                dataPoint3D9.yPosition = (double)pointF.Y;
                                DataPoint3D dataPoint3D10 = new DataPoint3D();
                                dataPoint3D10.index     = secondPoint.index;
                                dataPoint3D10.dataPoint = secondPoint.dataPoint;
                                dataPoint3D10.xPosition = secondPoint.xPosition;
                                dataPoint3D10.yPosition = (double)pointF2.Y;
                                Color backColor2   = (bottomDarkening == 0.0) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, (double)topDarkening);
                                Color borderColor2 = (bottomDarkening == 0.0) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, (double)topDarkening);
                                graphicsPath2 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, backColor2, borderColor2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D9, dataPoint3D10, points, pointIndex, 0f, operationType, surfaceSegmentType, flag3, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Left:
                            {
                                if (surfaceSegmentType != 0 && (area.reverseSeriesOrder || surfaceSegmentType != LineSegmentType.First))
                                {
                                    if (!area.reverseSeriesOrder)
                                    {
                                        break;
                                    }
                                    if (surfaceSegmentType != LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                }
                                DataPoint3D dataPoint3D4 = (firstPoint.xPosition <= secondPoint.xPosition) ? firstPoint : secondPoint;
                                DataPoint3D dataPoint3D5 = new DataPoint3D();
                                dataPoint3D5.index     = dataPoint3D4.index;
                                dataPoint3D5.dataPoint = dataPoint3D4.dataPoint;
                                dataPoint3D5.xPosition = dataPoint3D4.xPosition;
                                dataPoint3D5.yPosition = (double)((firstPoint.xPosition <= secondPoint.xPosition) ? pointF.Y : pointF2.Y);
                                DataPoint3D dataPoint3D6 = new DataPoint3D();
                                dataPoint3D6.index     = dataPoint3D4.index;
                                dataPoint3D6.dataPoint = dataPoint3D4.dataPoint;
                                dataPoint3D6.xPosition = dataPoint3D4.xPosition;
                                dataPoint3D6.yPosition = dataPoint3D4.yPosition;
                                graphicsPath2          = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D5, dataPoint3D6, points, pointIndex, 0f, operationType, LineSegmentType.Single, true, true, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Right:
                            {
                                if (surfaceSegmentType != 0 && (area.reverseSeriesOrder || surfaceSegmentType != LineSegmentType.Last))
                                {
                                    if (!area.reverseSeriesOrder)
                                    {
                                        break;
                                    }
                                    if (surfaceSegmentType != LineSegmentType.First)
                                    {
                                        break;
                                    }
                                }
                                DataPoint3D dataPoint3D11 = (secondPoint.xPosition >= firstPoint.xPosition) ? secondPoint : firstPoint;
                                DataPoint3D dataPoint3D12 = new DataPoint3D();
                                dataPoint3D12.index     = dataPoint3D11.index;
                                dataPoint3D12.dataPoint = dataPoint3D11.dataPoint;
                                dataPoint3D12.xPosition = dataPoint3D11.xPosition;
                                dataPoint3D12.yPosition = (double)((secondPoint.xPosition >= firstPoint.xPosition) ? pointF2.Y : pointF.Y);
                                DataPoint3D dataPoint3D13 = new DataPoint3D();
                                dataPoint3D13.index     = dataPoint3D11.index;
                                dataPoint3D13.dataPoint = dataPoint3D11.dataPoint;
                                dataPoint3D13.xPosition = dataPoint3D11.xPosition;
                                dataPoint3D13.yPosition = dataPoint3D11.yPosition;
                                graphicsPath2           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D12, dataPoint3D13, points, pointIndex, 0f, operationType, LineSegmentType.Single, true, true, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Back:
                            {
                                DataPoint3D dataPoint3D7 = new DataPoint3D();
                                dataPoint3D7.index     = firstPoint.index;
                                dataPoint3D7.dataPoint = firstPoint.dataPoint;
                                dataPoint3D7.xPosition = firstPoint.xPosition;
                                dataPoint3D7.yPosition = (double)pointF.Y;
                                DataPoint3D dataPoint3D8 = new DataPoint3D();
                                dataPoint3D8.index     = secondPoint.index;
                                dataPoint3D8.dataPoint = secondPoint.dataPoint;
                                dataPoint3D8.xPosition = secondPoint.xPosition;
                                dataPoint3D8.yPosition = (double)pointF2.Y;
                                SurfaceNames thinBorders2 = (SurfaceNames)0;
                                if (flag3)
                                {
                                    switch (surfaceSegmentType)
                                    {
                                    case LineSegmentType.Single:
                                        thinBorders2 = (SurfaceNames.Left | SurfaceNames.Right);
                                        break;

                                    case LineSegmentType.First:
                                        thinBorders2 = SurfaceNames.Left;
                                        break;

                                    case LineSegmentType.Last:
                                        thinBorders2 = SurfaceNames.Right;
                                        break;
                                    }
                                }
                                graphicsPath2 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames2, positionZ, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D8, dataPoint3D7, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders2);
                                break;
                            }

                            case SurfaceNames.Front:
                            {
                                DataPoint3D dataPoint3D2 = new DataPoint3D();
                                dataPoint3D2.index     = firstPoint.index;
                                dataPoint3D2.dataPoint = firstPoint.dataPoint;
                                dataPoint3D2.xPosition = firstPoint.xPosition;
                                dataPoint3D2.yPosition = (double)pointF.Y;
                                DataPoint3D dataPoint3D3 = new DataPoint3D();
                                dataPoint3D3.index     = secondPoint.index;
                                dataPoint3D3.dataPoint = secondPoint.dataPoint;
                                dataPoint3D3.xPosition = secondPoint.xPosition;
                                dataPoint3D3.yPosition = (double)pointF2.Y;
                                if (area.reverseSeriesOrder)
                                {
                                    switch (lineSegmentType)
                                    {
                                    case LineSegmentType.First:
                                        lineSegmentType = LineSegmentType.Last;
                                        break;

                                    case LineSegmentType.Last:
                                        lineSegmentType = LineSegmentType.First;
                                        break;
                                    }
                                }
                                switch (surfaceSegmentType)
                                {
                                case LineSegmentType.First:
                                    if (lineSegmentType == LineSegmentType.First)
                                    {
                                        goto default;
                                    }
                                    goto case LineSegmentType.Middle;

                                default:
                                    if (surfaceSegmentType != LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                    if (lineSegmentType == LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                    goto case LineSegmentType.Middle;

                                case LineSegmentType.Middle:
                                    lineSegmentType = LineSegmentType.Middle;
                                    break;

                                case LineSegmentType.Single:
                                    break;
                                }
                                SurfaceNames thinBorders = (SurfaceNames)0;
                                if (flag3)
                                {
                                    switch (surfaceSegmentType)
                                    {
                                    case LineSegmentType.Single:
                                        thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                                        break;

                                    case LineSegmentType.First:
                                        thinBorders = SurfaceNames.Left;
                                        break;

                                    case LineSegmentType.Last:
                                        thinBorders = SurfaceNames.Right;
                                        break;
                                    }
                                }
                                graphicsPath2 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames2, positionZ + depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D3, dataPoint3D2, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders);
                                break;
                            }
                            }
                            if (i == 2 && graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                            {
                                graphicsPath.CloseFigure();
                                graphicsPath.SetMarkers();
                                graphicsPath.AddPath(graphicsPath2, true);
                            }
                        }
                    }
                }
                return(graphicsPath);
            }
            return(graphicsPath);

IL_03d1:
            DataPoint3D axisIntersection = this.GetAxisIntersection(firstPoint, secondPoint, num);

            for (int num4 = 0; num4 <= 1; num4++)
            {
                GraphicsPath graphicsPath3 = null;
                if (num4 == 0 && !reversed)
                {
                    goto IL_03f7;
                }
                if (num4 == 1 && reversed)
                {
                    goto IL_03f7;
                }
                goto IL_045f;
IL_03f7:
                axisIntersection.dataPoint = secondPoint.dataPoint;
                axisIntersection.index     = secondPoint.index;
                graphicsPath3 = this.Draw3DSurface(firstPoint, axisIntersection, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop, clipOnBottom);
                goto IL_045f;
IL_046e:
                axisIntersection.dataPoint = firstPoint.dataPoint;
                axisIntersection.index     = firstPoint.index;
                graphicsPath3 = this.Draw3DSurface(axisIntersection, secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop, clipOnBottom);
                goto IL_04d6;
IL_045f:
                if (num4 == 1 && !reversed)
                {
                    goto IL_046e;
                }
                if (num4 == 0 && reversed)
                {
                    goto IL_046e;
                }
                goto IL_04d6;
IL_04d6:
                if (graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                {
                    graphicsPath.AddPath(graphicsPath3, true);
                }
            }
            return(graphicsPath);
        }
Exemplo n.º 15
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            GraphicsPath result = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (centerPointIndex == int.MaxValue)
            {
                centerPointIndex = GetCenterPointIndex(points);
            }
            DataPoint3D dataPoint3D        = (DataPoint3D)points[pointIndex];
            int         neighborPointIndex = pointIndex;
            DataPoint3D dataPoint3D2       = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
            bool        reversed           = false;

            if (dataPoint3D2.index > dataPoint3D.index)
            {
                DataPoint3D dataPoint3D3 = dataPoint3D2;
                dataPoint3D2 = dataPoint3D;
                dataPoint3D  = dataPoint3D3;
                reversed     = true;
            }
            if (matrix.perspective != 0f && centerPointIndex != int.MaxValue)
            {
                neighborPointIndex = pointIndex;
                if (pointIndex != centerPointIndex + 1)
                {
                    dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
                else if (!area.reverseSeriesOrder)
                {
                    dataPoint3D = ChartGraphics3D.FindPointByIndex(points, dataPoint3D2.index + 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
                else
                {
                    dataPoint3D2 = dataPoint3D;
                    dataPoint3D  = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
            }
            if (dataPoint3D2 == null || dataPoint3D == null)
            {
                return(result);
            }
            DataPoint3D dataPoint3D4 = dataPoint3D;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D4 = prevDataPointEx;
            }
            else if (dataPoint3D2.index > dataPoint3D.index)
            {
                dataPoint3D4 = dataPoint3D2;
            }
            if (!useBorderColor)
            {
                _ = dataPoint3D4.dataPoint.Color;
            }
            else
            {
                _ = dataPoint3D4.dataPoint.BorderColor;
            }
            _ = dataPoint3D4.dataPoint.BorderStyle;
            if (dataPoint3D4.dataPoint.Empty && dataPoint3D4.dataPoint.Color == Color.Empty)
            {
                _ = Color.Gray;
            }
            if (dataPoint3D4.dataPoint.Empty)
            {
                _ = dataPoint3D4.dataPoint.BorderStyle;
            }
            return(Draw3DSurface(dataPoint3D2, dataPoint3D, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, LineSegmentType.Single, topDarkening, bottomDarkening, thirdPointPosition, fourthPointPosition, clippedSegment, clipOnTop: true, clipOnBottom: true));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Draws a 3D surface connecting the two specified points in 2D space.
        /// Used to draw Line based charts.
        /// </summary>
        /// <param name="area">Chart area reference.</param>
        /// <param name="graph">Chart graphics.</param>
        /// <param name="matrix">Coordinates transformation matrix.</param>
        /// <param name="lightStyle">LightStyle style (None, Simplistic, Realistic).</param>
        /// <param name="prevDataPointEx">Previous data point object.</param>
        /// <param name="positionZ">Z position of the back side of the 3D surface.</param>
        /// <param name="depth">Depth of the 3D surface.</param>
        /// <param name="points">Array of points.</param>
        /// <param name="pointIndex">Index of point to draw.</param>
        /// <param name="pointLoopIndex">Index of points loop.</param>
        /// <param name="tension">Line tension.</param>
        /// <param name="operationType">AxisName of operation Drawing, Calculating Path or Both</param>
        /// <param name="topDarkening">Darkenning scale for top surface. 0 - None.</param>
        /// <param name="bottomDarkening">Darkenning scale for bottom surface. 0 - None.</param>
        /// <param name="thirdPointPosition">Position where the third point is actually located or float.NaN if same as in "firstPoint".</param>
        /// <param name="fourthPointPosition">Position where the fourth point is actually located or float.NaN if same as in "secondPoint".</param>
        /// <param name="clippedSegment">Indicates that drawn segment is 3D clipped. Only top/bottom should be drawn.</param>
        /// <returns>Returns elemnt shape path if operationType parameter is set to CalcElementPath, otherwise Null.</returns>
        protected override GraphicsPath Draw3DSurface(
            ChartArea area,
            ChartGraphics graph,
            Matrix3D matrix,
            LightStyle lightStyle,
            DataPoint3D prevDataPointEx,
            float positionZ,
            float depth,
            ArrayList points,
            int pointIndex,
            int pointLoopIndex,
            float tension,
            DrawingOperationTypes operationType,
            float topDarkening,
            float bottomDarkening,
            PointF thirdPointPosition,
            PointF fourthPointPosition,
            bool clippedSegment)
        {
            // Create graphics path for selection
            GraphicsPath resultPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath)
                                ? new GraphicsPath() : null;

            // Check if points are drawn from sides to center (do only once)
            if (centerPointIndex == int.MaxValue)
            {
                centerPointIndex = GetCenterPointIndex(points);
            }

            //************************************************************
            //** Find line first & second points
            //************************************************************
            DataPoint3D secondPoint     = (DataPoint3D)points[pointIndex];
            int         pointArrayIndex = pointIndex;
            DataPoint3D firstPoint      = ChartGraphics.FindPointByIndex(
                points,
                secondPoint.index - 1,
                (this.multiSeries) ? secondPoint : null,
                ref pointArrayIndex);

            // Fint point with line properties
            DataPoint3D pointAttr = secondPoint;

            if (prevDataPointEx.dataPoint.IsEmpty)
            {
                pointAttr = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                pointAttr = firstPoint;
            }

            // Adjust point visual properties
            Color          color     = (useBorderColor) ? pointAttr.dataPoint.BorderColor : pointAttr.dataPoint.Color;
            ChartDashStyle dashStyle = pointAttr.dataPoint.BorderDashStyle;

            if (pointAttr.dataPoint.IsEmpty && pointAttr.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (pointAttr.dataPoint.IsEmpty && pointAttr.dataPoint.BorderDashStyle == ChartDashStyle.NotSet)
            {
                dashStyle = ChartDashStyle.Solid;
            }

            //************************************************************
            //** Create "middle" point
            //************************************************************
            DataPoint3D middlePoint = new DataPoint3D();

            middlePoint.xPosition = secondPoint.xPosition;
            middlePoint.yPosition = firstPoint.yPosition;

            // Check if reversed drawing order required
            bool originalDrawOrder = true;

            if ((pointIndex + 1) < points.Count)
            {
                DataPoint3D p = (DataPoint3D)points[pointIndex + 1];
                if (p.index == firstPoint.index)
                {
                    originalDrawOrder = false;
                }
            }

            // Check in which order vertical & horizontal lines segments should be drawn
            if (centerPointIndex != int.MaxValue)
            {
                if (pointIndex >= centerPointIndex)
                {
                    originalDrawOrder = false;
                }
            }

            // Draw two segments of the step line
            GraphicsPath resultPathLine1, resultPathLine2;

            if (originalDrawOrder)
            {
                // Draw first line
                middlePoint.dataPoint = secondPoint.dataPoint;
                resultPathLine1       = graph.Draw3DSurface(
                    area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, color,
                    pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                    firstPoint, middlePoint,
                    points, pointIndex, 0f, operationType, LineSegmentType.First,
                    (this.showPointLines) ? true : false, false,
                    area.ReverseSeriesOrder,
                    this.multiSeries, 0, true);

                // No second draw of the prev. front line required
                graph.frontLinePen = null;

                // Draw second line
                middlePoint.dataPoint = firstPoint.dataPoint;
                resultPathLine2       = graph.Draw3DSurface(
                    area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, color,
                    pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                    middlePoint, secondPoint,
                    points, pointIndex, 0f, operationType, LineSegmentType.Last,
                    (this.showPointLines) ? true : false, false,
                    area.ReverseSeriesOrder,
                    this.multiSeries, 0, true);

                // No second draw of the prev. front line required
                graph.frontLinePen = null;
            }
            else
            {
                // Draw second line
                middlePoint.dataPoint = firstPoint.dataPoint;
                resultPathLine2       = graph.Draw3DSurface(
                    area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, color,
                    pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                    middlePoint, secondPoint,
                    points, pointIndex, 0f, operationType, LineSegmentType.Last,
                    (this.showPointLines) ? true : false, false,
                    area.ReverseSeriesOrder,
                    this.multiSeries, 0, true);

                // No second draw of the prev. front line required
                graph.frontLinePen = null;

                // Draw first line
                middlePoint.dataPoint = secondPoint.dataPoint;
                resultPathLine1       = graph.Draw3DSurface(
                    area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, color,
                    pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                    firstPoint, middlePoint,
                    points, pointIndex, 0f, operationType, LineSegmentType.First,
                    (this.showPointLines) ? true : false, false,
                    area.ReverseSeriesOrder,
                    this.multiSeries, 0, true);

                // No second draw of the prev. front line required
                graph.frontLinePen = null;
            }

            if (resultPath != null)
            {
                if (area.Common.ProcessModeRegions)
                {
                    if (resultPathLine1 != null && resultPathLine1.PointCount > 0)
                    {
                        area.Common.HotRegionsList.AddHotRegion(
                            resultPathLine1,
                            false,
                            graph,
                            prevDataPointEx.dataPoint,
                            prevDataPointEx.dataPoint.series.Name,
                            prevDataPointEx.index - 1);
                    }
                }

                if (resultPathLine2 != null && resultPathLine2.PointCount > 0)
                {
                    resultPath.AddPath(resultPathLine2, true);
                }
            }
            return(resultPath);
        }
        /// <summary>
        /// Draws a 3D surface connecting the two specified points in 2D space.
        /// Used to draw Line based charts.
        /// </summary>
        /// <param name="area">Chart area reference.</param>
        /// <param name="graph">Chart graphics.</param>
        /// <param name="matrix">Coordinates transformation matrix.</param>
        /// <param name="lightStyle">LightStyle style (None, Simplistic, Realistic).</param>
        /// <param name="prevDataPointEx">Previous data point object.</param>
        /// <param name="positionZ">Z position of the back side of the 3D surface.</param>
        /// <param name="depth">Depth of the 3D surface.</param>
        /// <param name="points">Array of points.</param>
        /// <param name="pointIndex">Index of point to draw.</param>
        /// <param name="pointLoopIndex">Index of points loop.</param>
        /// <param name="tension">Line tension.</param>
        /// <param name="operationType">AxisName of operation Drawing, Calculating Path or Both</param>
        /// <param name="topDarkening">Darkenning scale for top surface. 0 - None.</param>
        /// <param name="bottomDarkening">Darkenning scale for bottom surface. 0 - None.</param>
        /// <param name="thirdPointPosition">Position where the third point is actually located or float.NaN if same as in "firstPoint".</param>
        /// <param name="fourthPointPosition">Position where the fourth point is actually located or float.NaN if same as in "secondPoint".</param>
        /// <param name="clippedSegment">Indicates that drawn segment is 3D clipped. Only top/bottom should be drawn.</param>
        /// <returns>Returns elemnt shape path if operationType parameter is set to CalcElementPath, otherwise Null.</returns>
        protected override GraphicsPath Draw3DSurface(
            ChartArea area,
            ChartGraphics graph,
            Matrix3D matrix,
            LightStyle lightStyle,
            DataPoint3D prevDataPointEx,
            float positionZ,
            float depth,
            ArrayList points,
            int pointIndex,
            int pointLoopIndex,
            float tension,
            DrawingOperationTypes operationType,
            float topDarkening,
            float bottomDarkening,
            PointF thirdPointPosition,
            PointF fourthPointPosition,
            bool clippedSegment)
        {
            // Create graphics path for selection
            GraphicsPath resultPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath)
                                ? new GraphicsPath() : null;

            // Check if points are drawn from sides to center (do only once)
            if (centerPointIndex == int.MaxValue)
            {
                centerPointIndex = GetCenterPointIndex(points);
            }

            //************************************************************
            //** Find line first & second points
            //************************************************************
            DataPoint3D secondPoint     = (DataPoint3D)points[pointIndex];
            int         pointArrayIndex = pointIndex;
            DataPoint3D firstPoint      = ChartGraphics.FindPointByIndex(
                points,
                secondPoint.index - 1,
                (this.multiSeries) ? secondPoint : null,
                ref pointArrayIndex);

            // Fint point with line properties
            DataPoint3D pointAttr = secondPoint;

            if (prevDataPointEx.dataPoint.IsEmpty)
            {
                pointAttr = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                pointAttr = firstPoint;
            }

            // Adjust point visual properties
            Color          color     = (useBorderColor) ? pointAttr.dataPoint.BorderColor : pointAttr.dataPoint.Color;
            ChartDashStyle dashStyle = pointAttr.dataPoint.BorderDashStyle;

            if (pointAttr.dataPoint.IsEmpty && pointAttr.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (pointAttr.dataPoint.IsEmpty && pointAttr.dataPoint.BorderDashStyle == ChartDashStyle.NotSet)
            {
                dashStyle = ChartDashStyle.Solid;
            }

            // Set up kagi chart
            if (currentKagiDirection == 0)
            {
                // Get up price color
                this.kagiUpColor = secondPoint.dataPoint.series.Color;
                string         priceUpColorString = secondPoint.dataPoint.series[CustomPropertyName.PriceUpColor];
                ColorConverter colorConverter     = new ColorConverter();
                if (priceUpColorString != null)
                {
                    try
                    {
                        this.kagiUpColor = (Color)colorConverter.ConvertFromString(null, CultureInfo.InvariantCulture, priceUpColorString);
                    }
                    catch
                    {
                        throw(new InvalidOperationException(SR.ExceptionKagiAttributeFormatInvalid("Up Brick color")));
                    }
                }

                // Check direction of first line (up or down)
                currentKagiDirection = (firstPoint.yPosition > secondPoint.yPosition) ?
                                       1 : -1;
            }

            // Set up movement colors and width
            Color lineColor = (currentKagiDirection == 1) ? this.kagiUpColor : color;

            //************************************************************
            //** Create "middle" point
            //************************************************************
            DataPoint3D middlePoint = new DataPoint3D();

            middlePoint.xPosition = secondPoint.xPosition;
            middlePoint.yPosition = firstPoint.yPosition;

            // Check if reversed drawing order required
            bool originalDrawOrder = true;

            if ((pointIndex + 1) < points.Count)
            {
                DataPoint3D p = (DataPoint3D)points[pointIndex + 1];
                if (p.index == firstPoint.index)
                {
                    originalDrawOrder = false;
                }
            }

            // Check in which order vertical & horizontal lines segments should be drawn
            if (centerPointIndex != int.MaxValue)
            {
                if (pointIndex >= centerPointIndex)
                {
                    originalDrawOrder = false;
                }
            }


            // Check if vertical line should be draw as to segments of different color
            DataPoint3D vertSplitPoint = null;

            if (secondPoint.index >= 3)            //Point3D.index is 1 based
            {
                // Check current direction
                int direction = (firstPoint.yPosition > secondPoint.yPosition) ?
                                1 : -1;

                // Proceed only when direction is changed
                if (direction != currentKagiDirection)
                {
                    // Find prev line low & high
                    DataPoint3D prevPoint = ChartGraphics.FindPointByIndex(
                        points,
                        secondPoint.index - 2,
                        (this.multiSeries) ? secondPoint : null,
                        ref pointArrayIndex);

                    bool twoVertSegments = false;
                    if (firstPoint.yPosition > prevPoint.yPosition &&
                        firstPoint.yPosition > secondPoint.yPosition &&
                        prevPoint.yPosition > secondPoint.yPosition)
                    {
                        twoVertSegments = true;
                    }
                    else if (firstPoint.yPosition < prevPoint.yPosition &&
                             firstPoint.yPosition < secondPoint.yPosition &&
                             prevPoint.yPosition < secondPoint.yPosition)
                    {
                        twoVertSegments = true;
                    }

                    if (twoVertSegments)
                    {
                        vertSplitPoint           = new DataPoint3D();
                        vertSplitPoint.xPosition = secondPoint.xPosition;
                        vertSplitPoint.yPosition = prevPoint.yPosition;
                        vertSplitPoint.dataPoint = secondPoint.dataPoint;
                    }
                }
            }

            // Draw two or three segments of the step line
            GraphicsPath[] resultPathLine = new GraphicsPath[3];
            for (int segmentIndex = 0; segmentIndex < 2; segmentIndex++)
            {
                DataPoint3D     point1 = firstPoint, point2 = secondPoint;
                LineSegmentType lineSegmentType = LineSegmentType.First;

                if (segmentIndex == 0)
                {
                    lineSegmentType       = (originalDrawOrder) ? LineSegmentType.First : LineSegmentType.Last;
                    middlePoint.dataPoint = (originalDrawOrder) ? secondPoint.dataPoint : firstPoint.dataPoint;
                    point1 = (originalDrawOrder) ? firstPoint : middlePoint;
                    point2 = (originalDrawOrder) ? middlePoint : secondPoint;
                }
                else if (segmentIndex == 1)
                {
                    lineSegmentType       = (!originalDrawOrder) ? LineSegmentType.First : LineSegmentType.Last;
                    middlePoint.dataPoint = (!originalDrawOrder) ? secondPoint.dataPoint : secondPoint.dataPoint;
                    point1 = (!originalDrawOrder) ? firstPoint : middlePoint;
                    point2 = (!originalDrawOrder) ? middlePoint : secondPoint;
                }

                // Draw horizontal surface
                if (lineSegmentType == LineSegmentType.First ||
                    vertSplitPoint == null)
                {
                    resultPathLine[segmentIndex] = new GraphicsPath();
                    resultPathLine[segmentIndex] = graph.Draw3DSurface(
                        area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, lineColor,
                        pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                        point1, point2,
                        points, pointIndex, 0f, operationType, lineSegmentType,
                        (this.showPointLines) ? true : false, false,
                        area.ReverseSeriesOrder,
                        this.multiSeries, 0, true);
                }
                else
                {
                    if (!originalDrawOrder)
                    {
                        lineColor = (currentKagiDirection == -1) ? this.kagiUpColor : color;
                    }

                    // Draw verticla line as two segments
                    resultPathLine[segmentIndex] = new GraphicsPath();
                    resultPathLine[segmentIndex] = graph.Draw3DSurface(
                        area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, lineColor,
                        pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                        point1, vertSplitPoint,
                        points, pointIndex, 0f, operationType, LineSegmentType.Middle,
                        (this.showPointLines) ? true : false, false,
                        area.ReverseSeriesOrder,
                        this.multiSeries, 0, true);

                    // No second draw of the prev. front line required
                    graph.frontLinePen = null;

                    // Change direction
                    currentKagiDirection = (currentKagiDirection == 1) ? -1 : 1;

                    // Set color
                    if (originalDrawOrder)
                    {
                        lineColor = (currentKagiDirection == 1) ? this.kagiUpColor : color;
                    }
                    else
                    {
                        lineColor = (currentKagiDirection == -1) ? this.kagiUpColor : color;
                    }

                    resultPathLine[2] = new GraphicsPath();
                    resultPathLine[2] = graph.Draw3DSurface(
                        area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, lineColor,
                        pointAttr.dataPoint.BorderColor, pointAttr.dataPoint.BorderWidth, dashStyle,
                        vertSplitPoint, point2,
                        points, pointIndex, 0f, operationType, lineSegmentType,
                        (this.showPointLines) ? true : false, false,
                        area.ReverseSeriesOrder,
                        this.multiSeries, 0, true);

                    if (!originalDrawOrder)
                    {
                        lineColor = (currentKagiDirection == 1) ? this.kagiUpColor : color;
                    }
                }

                // No second draw of the prev. front line required
                graph.frontLinePen = null;
            }

            if (resultPath != null)
            {
                if (resultPathLine[0] != null)
                {
                    resultPath.AddPath(resultPathLine[0], true);
                }
                if (resultPathLine[1] != null)
                {
                    resultPath.AddPath(resultPathLine[1], true);
                }
                if (resultPathLine[2] != null)
                {
                    resultPath.AddPath(resultPathLine[2], true);
                }
            }
            return(resultPath);
        }
Exemplo n.º 18
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (base.centerPointIndex == 2147483647)
            {
                base.centerPointIndex = base.GetCenterPointIndex(points);
            }
            DataPoint3D dataPoint3D  = (DataPoint3D)points[pointIndex];
            int         num          = pointIndex;
            DataPoint3D dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, base.multiSeries ? dataPoint3D : null, ref num);
            DataPoint3D dataPoint3D3 = dataPoint3D;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D3 = prevDataPointEx;
            }
            else if (dataPoint3D2.index > dataPoint3D.index)
            {
                dataPoint3D3 = dataPoint3D2;
            }
            Color          backColor   = base.useBorderColor ? dataPoint3D3.dataPoint.BorderColor : dataPoint3D3.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D3.dataPoint.BorderStyle;

            if (dataPoint3D3.dataPoint.Empty && dataPoint3D3.dataPoint.Color == Color.Empty)
            {
                backColor = Color.Gray;
            }
            if (dataPoint3D3.dataPoint.Empty && dataPoint3D3.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            DataPoint3D dataPoint3D4 = new DataPoint3D();

            dataPoint3D4.xPosition = dataPoint3D.xPosition;
            dataPoint3D4.yPosition = dataPoint3D2.yPosition;
            bool flag = true;

            if (pointIndex + 1 < points.Count)
            {
                DataPoint3D dataPoint3D5 = (DataPoint3D)points[pointIndex + 1];
                if (dataPoint3D5.index == dataPoint3D2.index)
                {
                    flag = false;
                }
            }
            if (base.centerPointIndex != 2147483647 && pointIndex >= base.centerPointIndex)
            {
                flag = false;
            }
            GraphicsPath graphicsPath2;
            GraphicsPath graphicsPath3;

            if (flag)
            {
                dataPoint3D4.dataPoint = dataPoint3D.dataPoint;
                graphicsPath2          = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, dataPoint3D2, dataPoint3D4, points, pointIndex, 0f, operationType, LineSegmentType.First, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                graph.frontLinePen     = null;
                dataPoint3D4.dataPoint = dataPoint3D2.dataPoint;
                graphicsPath3          = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, dataPoint3D4, dataPoint3D, points, pointIndex, 0f, operationType, LineSegmentType.Last, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                graph.frontLinePen     = null;
            }
            else
            {
                dataPoint3D4.dataPoint = dataPoint3D2.dataPoint;
                graphicsPath3          = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, dataPoint3D4, dataPoint3D, points, pointIndex, 0f, operationType, LineSegmentType.Last, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                graph.frontLinePen     = null;
                dataPoint3D4.dataPoint = dataPoint3D.dataPoint;
                graphicsPath2          = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, dataPoint3D2, dataPoint3D4, points, pointIndex, 0f, operationType, LineSegmentType.First, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                graph.frontLinePen     = null;
            }
            if (graphicsPath != null)
            {
                if (area.Common.ProcessModeRegions && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                {
                    area.Common.HotRegionsList.AddHotRegion(graphicsPath2, false, graph, prevDataPointEx.dataPoint, prevDataPointEx.dataPoint.series.Name, prevDataPointEx.index - 1);
                }
                if (graphicsPath3 != null && graphicsPath3.PointCount > 0)
                {
                    graphicsPath.AddPath(graphicsPath3, true);
                }
            }
            return(graphicsPath);
        }
Exemplo n.º 19
0
        private void DrawLabels3D(ChartArea area, ChartGraphics graph, CommonElements common, DataPoint3D pointEx, float positionZ, float depth)
        {
            string label            = pointEx.dataPoint.Label;
            bool   showLabelAsValue = pointEx.dataPoint.ShowLabelAsValue;

            if ((pointEx.dataPoint.Empty || (!pointEx.dataPoint.series.ShowLabelAsValue && !showLabelAsValue && label.Length <= 0)) && !showLabelAsValue && label.Length <= 0)
            {
                return;
            }
            StringFormat stringFormat = new StringFormat();

            stringFormat.Alignment     = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;
            string text;

            if (label.Length == 0)
            {
                double value = pointEx.dataPoint.YValues[(base.labelYValueIndex == -1) ? base.yValueIndex : base.labelYValueIndex];
                if (this.hundredPercentStacked && pointEx.dataPoint.LabelFormat.Length == 0)
                {
                    value = Math.Round(value, 2);
                }
                text = ValueConverter.FormatValue(pointEx.dataPoint.series.chart, pointEx.dataPoint, value, pointEx.dataPoint.LabelFormat, pointEx.dataPoint.series.YValueType, ChartElementType.DataPoint);
            }
            else
            {
                text = pointEx.dataPoint.ReplaceKeywords(label);
                if (pointEx.dataPoint.series.chart != null && pointEx.dataPoint.series.chart.LocalizeTextHandler != null)
                {
                    text = pointEx.dataPoint.series.chart.LocalizeTextHandler(pointEx.dataPoint, text, pointEx.dataPoint.ElementId, ChartElementType.DataPoint);
                }
            }
            Point3D[] array = new Point3D[1]
            {
                new Point3D((float)pointEx.xPosition, (float)((float)(pointEx.yPosition + pointEx.height) / 2.0), positionZ + depth)
            };
            area.matrix3D.TransformPoints(array);
            SizeF      relativeSize = graph.GetRelativeSize(graph.MeasureString(text, pointEx.dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
            RectangleF backPosition = RectangleF.Empty;
            SizeF      sizeF        = new SizeF(relativeSize.Width, relativeSize.Height);

            sizeF.Height += (float)(relativeSize.Height / 8.0);
            sizeF.Width  += sizeF.Width / (float)text.Length;
            backPosition  = new RectangleF((float)(array[0].PointF.X - sizeF.Width / 2.0), (float)(array[0].PointF.Y - sizeF.Height / 2.0 - relativeSize.Height / 10.0), sizeF.Width, sizeF.Height);
            graph.DrawPointLabelStringRel(common, text, pointEx.dataPoint.Font, new SolidBrush(pointEx.dataPoint.FontColor), array[0].PointF, stringFormat, pointEx.dataPoint.FontAngle, backPosition, pointEx.dataPoint.LabelBackColor, pointEx.dataPoint.LabelBorderColor, pointEx.dataPoint.LabelBorderWidth, pointEx.dataPoint.LabelBorderStyle, pointEx.dataPoint.series, pointEx.dataPoint, pointEx.index - 1);
        }
Exemplo n.º 20
0
        protected virtual void GetBottomPointsPosition(CommonElements common, ChartArea area, float axisPosition, ref DataPoint3D firstPoint, ref DataPoint3D secondPoint, out PointF thirdPoint, out PointF fourthPoint)
        {
            Axis axis = area.GetAxis(AxisName.Y, firstPoint.dataPoint.series.YAxisType, firstPoint.dataPoint.series.YSubAxisName);

            thirdPoint = new PointF(y: (float)axis.GetPosition(firstPoint.dataPoint.YValues[1]), x: (float)firstPoint.xPosition);
            float y2 = (float)axis.GetPosition(secondPoint.dataPoint.YValues[1]);

            fourthPoint = new PointF((float)secondPoint.xPosition, y2);
            if (!float.IsNaN(thirdPointY2Value))
            {
                thirdPoint.Y = thirdPointY2Value;
            }
            if (!float.IsNaN(fourthPointY2Value))
            {
                fourthPoint.Y = fourthPointY2Value;
            }
        }
Exemplo n.º 21
0
 protected virtual void GetTopSurfaceVisibility(ChartArea area, DataPoint3D firstPoint, DataPoint3D secondPoint, bool upSideDown, float positionZ, float depth, Matrix3D matrix, ref SurfaceNames visibleSurfaces)
 {
     if ((visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top)
     {
         visibleSurfaces ^= SurfaceNames.Top;
     }
     Point3D[] array = new Point3D[3];
     if (!area.reverseSeriesOrder)
     {
         if ((!upSideDown && firstPoint.xPosition < secondPoint.xPosition) || (upSideDown && firstPoint.xPosition > secondPoint.xPosition))
         {
             array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
             array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
             array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
         }
         else
         {
             array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
             array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
             array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
         }
     }
     else if ((!upSideDown && secondPoint.xPosition < firstPoint.xPosition) || (upSideDown && secondPoint.xPosition > firstPoint.xPosition))
     {
         array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
         array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
         array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
     }
     else
     {
         array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
         array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
         array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
     }
     matrix.TransformPoints(array);
     if (ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]))
     {
         visibleSurfaces |= SurfaceNames.Top;
     }
     GetBottomPointsPosition(area.Common, area, 0f, ref firstPoint, ref secondPoint, out PointF thirdPoint, out PointF fourthPoint);
     if ((visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom)
     {
         visibleSurfaces ^= SurfaceNames.Bottom;
     }
     array = new Point3D[3];
     if (!area.reverseSeriesOrder)
     {
         if ((!upSideDown && firstPoint.xPosition < secondPoint.xPosition) || (upSideDown && firstPoint.xPosition > secondPoint.xPosition))
         {
             array[0] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ + depth);
             array[1] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ);
             array[2] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ);
         }
         else
         {
             array[0] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ + depth);
             array[1] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ);
             array[2] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ);
         }
     }
     else if ((!upSideDown && secondPoint.xPosition < firstPoint.xPosition) || (upSideDown && secondPoint.xPosition > firstPoint.xPosition))
     {
         array[0] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ + depth);
         array[1] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ);
         array[2] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ);
     }
     else
     {
         array[0] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ + depth);
         array[1] = new Point3D((float)firstPoint.xPosition, thirdPoint.Y, positionZ);
         array[2] = new Point3D((float)secondPoint.xPosition, fourthPoint.Y, positionZ);
     }
     matrix.TransformPoints(array);
     if (ChartGraphics3D.IsSurfaceVisible(array[2], array[1], array[0]))
     {
         visibleSurfaces |= SurfaceNames.Bottom;
     }
 }
Exemplo n.º 22
0
        protected override GraphicsPath Draw3DSurface(DataPoint3D firstPoint, DataPoint3D secondPoint, bool reversed, ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, LineSegmentType surfaceSegmentType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment, bool clipOnTop, bool clipOnBottom)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;
            DataPoint3D  dataPoint3D  = secondPoint;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                dataPoint3D = firstPoint;
            }
            Color          color       = useBorderColor ? dataPoint3D.dataPoint.BorderColor : dataPoint3D.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D.dataPoint.BorderStyle;

            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            float num = (float)vAxis.GetPosition(vAxis.Crossing);

            GetBottomPointsPosition(common, area, num, ref firstPoint, ref secondPoint, out PointF thirdPoint, out PointF fourthPoint);
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                thirdPoint.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                fourthPoint.Y = fourthPointPosition.Y;
            }
            if ((firstPoint.yPosition > (double)thirdPoint.Y && secondPoint.yPosition < (double)fourthPoint.Y) || (firstPoint.yPosition < (double)thirdPoint.Y && secondPoint.yPosition > (double)fourthPoint.Y))
            {
                if (tension != 0f)
                {
                    throw new InvalidOperationException(SR.Exception3DSplineY1ValueIsLessThenY2);
                }
                PointF      linesIntersection = ChartGraphics3D.GetLinesIntersection((float)firstPoint.xPosition, (float)firstPoint.yPosition, (float)secondPoint.xPosition, (float)secondPoint.yPosition, thirdPoint.X, thirdPoint.Y, fourthPoint.X, fourthPoint.Y);
                DataPoint3D dataPoint3D2      = new DataPoint3D();
                dataPoint3D2.xPosition = linesIntersection.X;
                dataPoint3D2.yPosition = linesIntersection.Y;
                bool flag = true;
                if (double.IsNaN(linesIntersection.X) || double.IsNaN(linesIntersection.Y))
                {
                    flag = false;
                }
                else
                {
                    if ((decimal)linesIntersection.X == (decimal)firstPoint.xPosition && (decimal)linesIntersection.Y == (decimal)firstPoint.yPosition)
                    {
                        flag = false;
                    }
                    if ((decimal)linesIntersection.X == (decimal)secondPoint.xPosition && (decimal)linesIntersection.Y == (decimal)secondPoint.yPosition)
                    {
                        flag = false;
                    }
                }
                if (flag)
                {
                    reversed = false;
                    if (pointIndex + 1 < points.Count && ((DataPoint3D)points[pointIndex + 1]).index == firstPoint.index)
                    {
                        reversed = true;
                    }
                    for (int i = 0; i <= 1; i++)
                    {
                        GraphicsPath graphicsPath2 = null;
                        if ((i == 0 && !reversed) || (i == 1 && reversed))
                        {
                            fourthPointY2Value     = (float)dataPoint3D2.yPosition;
                            dataPoint3D2.dataPoint = secondPoint.dataPoint;
                            dataPoint3D2.index     = secondPoint.index;
                            graphicsPath2          = Draw3DSurface(firstPoint, dataPoint3D2, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop: true, clipOnBottom: true);
                        }
                        if ((i == 1 && !reversed) || (i == 0 && reversed))
                        {
                            thirdPointY2Value      = (float)dataPoint3D2.yPosition;
                            dataPoint3D2.dataPoint = firstPoint.dataPoint;
                            dataPoint3D2.index     = firstPoint.index;
                            graphicsPath2          = Draw3DSurface(dataPoint3D2, secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop: true, clipOnBottom: true);
                        }
                        if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                        {
                            graphicsPath.AddPath(graphicsPath2, connect: true);
                        }
                        thirdPointY2Value  = float.NaN;
                        fourthPointY2Value = float.NaN;
                    }
                    return(graphicsPath);
                }
            }
            float num2 = (float)Math.Min(firstPoint.xPosition, secondPoint.xPosition);
            float val  = (float)Math.Min(firstPoint.yPosition, secondPoint.yPosition);

            val = Math.Min(val, num);
            float num3 = (float)Math.Max(firstPoint.xPosition, secondPoint.xPosition);
            float val2 = (float)Math.Max(firstPoint.yPosition, secondPoint.yPosition);

            val2 = Math.Max(val2, num);
            RectangleF   position        = new RectangleF(num2, val, num3 - num2, val2 - val);
            SurfaceNames visibleSurfaces = graph.GetVisibleSurfaces(position, positionZ, depth, matrix);
            bool         upSideDown      = false;

            if (firstPoint.yPosition >= (double)thirdPoint.Y && secondPoint.yPosition >= (double)fourthPoint.Y)
            {
                upSideDown = true;
                bool num4  = (visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag2 = (visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Top;
                if (num4)
                {
                    visibleSurfaces |= SurfaceNames.Bottom;
                }
                if (flag2)
                {
                    visibleSurfaces |= SurfaceNames.Top;
                }
            }
            GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
            bool flag3 = true;

            if (tension != 0f)
            {
                if ((visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom)
                {
                    flag3 = false;
                }
                if ((visibleSurfaces & SurfaceNames.Bottom) == 0 && (visibleSurfaces & SurfaceNames.Top) == 0)
                {
                    flag3 = false;
                }
                visibleSurfaces |= SurfaceNames.Bottom;
                visibleSurfaces |= SurfaceNames.Top;
            }
            firstPoint.xPosition  = Math.Round(firstPoint.xPosition, 5);
            firstPoint.yPosition  = Math.Round(firstPoint.yPosition, 5);
            secondPoint.xPosition = Math.Round(secondPoint.xPosition, 5);
            secondPoint.yPosition = Math.Round(secondPoint.yPosition, 5);
            if (ClipTopPoints(graphicsPath, ref firstPoint, ref secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            if (ClipBottomPoints(graphicsPath, ref firstPoint, ref secondPoint, ref thirdPoint, ref fourthPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            for (int j = 1; j <= 2; j++)
            {
                SurfaceNames[] array = null;
                array = ((!flag3) ? new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Top,
                    SurfaceNames.Bottom,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                } : new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Bottom,
                    SurfaceNames.Top,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                });
                LineSegmentType lineSegmentType = LineSegmentType.Middle;
                SurfaceNames[]  array2          = array;
                foreach (SurfaceNames surfaceNames in array2)
                {
                    if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames, visibleSurfaces, color, points, firstPoint, secondPoint, multiSeries, reversed, ref lineSegmentType) != j)
                    {
                        continue;
                    }
                    Color backColor = color;
                    Color color2    = dataPoint3D.dataPoint.BorderColor;
                    if (j == 1)
                    {
                        if (backColor.A == byte.MaxValue)
                        {
                            continue;
                        }
                        backColor = Color.Transparent;
                        if (color2 == Color.Empty)
                        {
                            color2 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                        }
                    }
                    GraphicsPath graphicsPath3 = null;
                    switch (surfaceNames)
                    {
                    case SurfaceNames.Top:
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, tension, operationType, LineSegmentType.Middle, showPointLines ? true : false, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;

                    case SurfaceNames.Bottom:
                    {
                        DataPoint3D dataPoint3D13 = new DataPoint3D();
                        dataPoint3D13.dataPoint = firstPoint.dataPoint;
                        dataPoint3D13.index     = firstPoint.index;
                        dataPoint3D13.xPosition = firstPoint.xPosition;
                        dataPoint3D13.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D14 = new DataPoint3D();
                        dataPoint3D14.dataPoint = secondPoint.dataPoint;
                        dataPoint3D14.index     = secondPoint.index;
                        dataPoint3D14.xPosition = secondPoint.xPosition;
                        dataPoint3D14.yPosition = fourthPoint.Y;
                        graphicsPath3           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D13, dataPoint3D14, points, pointIndex, tension, operationType, LineSegmentType.Middle, showPointLines ? true : false, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 1, clipInsideArea: true);
                        break;
                    }

                    case SurfaceNames.Left:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last))
                        {
                            DataPoint3D dataPoint3D10 = (firstPoint.xPosition <= secondPoint.xPosition) ? firstPoint : secondPoint;
                            DataPoint3D dataPoint3D11 = new DataPoint3D();
                            dataPoint3D11.xPosition = dataPoint3D10.xPosition;
                            dataPoint3D11.yPosition = ((firstPoint.xPosition <= secondPoint.xPosition) ? thirdPoint.Y : fourthPoint.Y);
                            DataPoint3D dataPoint3D12 = new DataPoint3D();
                            dataPoint3D12.xPosition = dataPoint3D10.xPosition;
                            dataPoint3D12.yPosition = dataPoint3D10.yPosition;
                            graphicsPath3           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D11, dataPoint3D12, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: false, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Right:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First))
                        {
                            DataPoint3D dataPoint3D7 = (secondPoint.xPosition >= firstPoint.xPosition) ? secondPoint : firstPoint;
                            DataPoint3D dataPoint3D8 = new DataPoint3D();
                            dataPoint3D8.xPosition = dataPoint3D7.xPosition;
                            dataPoint3D8.yPosition = ((secondPoint.xPosition >= firstPoint.xPosition) ? fourthPoint.Y : thirdPoint.Y);
                            DataPoint3D dataPoint3D9 = new DataPoint3D();
                            dataPoint3D9.xPosition = dataPoint3D7.xPosition;
                            dataPoint3D9.yPosition = dataPoint3D7.yPosition;
                            graphicsPath3          = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D8, dataPoint3D9, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: false, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Back:
                    {
                        DataPoint3D dataPoint3D5 = new DataPoint3D();
                        dataPoint3D5.dataPoint = firstPoint.dataPoint;
                        dataPoint3D5.index     = firstPoint.index;
                        dataPoint3D5.xPosition = firstPoint.xPosition;
                        dataPoint3D5.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D6 = new DataPoint3D();
                        dataPoint3D6.dataPoint = secondPoint.dataPoint;
                        dataPoint3D6.index     = secondPoint.index;
                        dataPoint3D6.xPosition = secondPoint.xPosition;
                        dataPoint3D6.yPosition = fourthPoint.Y;
                        graphicsPath3          = Draw3DSplinePolygon(graph, area, positionZ, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D6, dataPoint3D5, points, pointIndex, tension, operationType, lineSegmentType, showPointLines ? true : false);
                        break;
                    }

                    case SurfaceNames.Front:
                    {
                        DataPoint3D dataPoint3D3 = new DataPoint3D();
                        dataPoint3D3.dataPoint = firstPoint.dataPoint;
                        dataPoint3D3.index     = firstPoint.index;
                        dataPoint3D3.xPosition = firstPoint.xPosition;
                        dataPoint3D3.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D4 = new DataPoint3D();
                        dataPoint3D4.dataPoint = secondPoint.dataPoint;
                        dataPoint3D4.index     = secondPoint.index;
                        dataPoint3D4.xPosition = secondPoint.xPosition;
                        dataPoint3D4.yPosition = fourthPoint.Y;
                        if (area.reverseSeriesOrder)
                        {
                            switch (lineSegmentType)
                            {
                            case LineSegmentType.First:
                                lineSegmentType = LineSegmentType.Last;
                                break;

                            case LineSegmentType.Last:
                                lineSegmentType = LineSegmentType.First;
                                break;
                            }
                        }
                        if (surfaceSegmentType != 0)
                        {
                            if (surfaceSegmentType == LineSegmentType.Middle || (surfaceSegmentType == LineSegmentType.First && lineSegmentType != LineSegmentType.First) || (surfaceSegmentType == LineSegmentType.Last && lineSegmentType != LineSegmentType.Last))
                            {
                                lineSegmentType = LineSegmentType.Middle;
                            }
                            if (reversed)
                            {
                                switch (lineSegmentType)
                                {
                                case LineSegmentType.First:
                                    lineSegmentType = LineSegmentType.Last;
                                    break;

                                case LineSegmentType.Last:
                                    lineSegmentType = LineSegmentType.First;
                                    break;
                                }
                            }
                        }
                        graphicsPath3 = Draw3DSplinePolygon(graph, area, positionZ + depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D4, dataPoint3D3, points, pointIndex, tension, operationType, lineSegmentType, showPointLines ? true : false);
                        break;
                    }
                    }
                    if (j == 2 && graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                    {
                        graphicsPath.CloseFigure();
                        graphicsPath.AddPath(graphicsPath3, connect: true);
                    }
                }
            }
            return(graphicsPath);
        }
Exemplo n.º 23
0
 protected virtual void ProcessSinglePoint3D(DataPoint3D pointEx, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, RectangleF columnPosition, int pointIndex)
 {
     ProcessSinglePoint3D(pointEx, selection, graph, common, area);
 }
Exemplo n.º 24
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (centerPointIndex == int.MaxValue)
            {
                centerPointIndex = GetCenterPointIndex(points);
            }
            DataPoint3D dataPoint3D        = (DataPoint3D)points[pointIndex];
            int         neighborPointIndex = pointIndex;
            DataPoint3D dataPoint3D2       = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
            bool        flag = false;

            if (dataPoint3D2.index > dataPoint3D.index)
            {
                DataPoint3D dataPoint3D3 = dataPoint3D2;
                dataPoint3D2 = dataPoint3D;
                dataPoint3D  = dataPoint3D3;
                flag         = true;
            }
            if (matrix.perspective != 0f && centerPointIndex != int.MaxValue)
            {
                neighborPointIndex = pointIndex;
                if (pointIndex != centerPointIndex + 1)
                {
                    dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
                else if (!area.reverseSeriesOrder)
                {
                    dataPoint3D = ChartGraphics3D.FindPointByIndex(points, dataPoint3D2.index + 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
                else
                {
                    dataPoint3D2 = dataPoint3D;
                    dataPoint3D  = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, multiSeries ? dataPoint3D : null, ref neighborPointIndex);
                }
            }
            if (dataPoint3D2 == null || dataPoint3D == null)
            {
                return(graphicsPath);
            }
            DataPoint3D dataPoint3D4 = dataPoint3D;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D4 = prevDataPointEx;
            }
            else if (dataPoint3D2.index > dataPoint3D.index)
            {
                dataPoint3D4 = dataPoint3D2;
            }
            if (!useBorderColor)
            {
                _ = dataPoint3D4.dataPoint.Color;
            }
            else
            {
                _ = dataPoint3D4.dataPoint.BorderColor;
            }
            _ = dataPoint3D4.dataPoint.BorderStyle;
            if (dataPoint3D4.dataPoint.Empty && dataPoint3D4.dataPoint.Color == Color.Empty)
            {
                _ = Color.Gray;
            }
            if (dataPoint3D4.dataPoint.Empty)
            {
                _ = dataPoint3D4.dataPoint.BorderStyle;
            }
            flag = false;
            for (int i = 1; pointIndex + i < points.Count; i++)
            {
                DataPoint3D dataPoint3D5 = (DataPoint3D)points[pointIndex + i];
                if (dataPoint3D5.dataPoint.series.Name == dataPoint3D2.dataPoint.series.Name)
                {
                    if (dataPoint3D5.index == dataPoint3D2.index)
                    {
                        flag = true;
                    }
                    break;
                }
            }
            if (tension != 0f)
            {
                GraphicsPath splineFlattenPath = graph.GetSplineFlattenPath(area, matrix, positionZ, depth, dataPoint3D2, dataPoint3D, points, pointIndex, tension, flatten: true, translateCoordinates: false, 0);
                PointF[]     array             = null;
                flag = (pointIndex < neighborPointIndex);
                if (flag)
                {
                    splineFlattenPath.Reverse();
                }
                array = splineFlattenPath.PathPoints;
                DataPoint3D     dataPoint3D6    = new DataPoint3D();
                DataPoint3D     dataPoint3D7    = new DataPoint3D();
                LineSegmentType lineSegmentType = LineSegmentType.Middle;
                for (int j = 1; j < array.Length; j++)
                {
                    if (!flag)
                    {
                        dataPoint3D6.dataPoint = dataPoint3D2.dataPoint;
                        dataPoint3D6.index     = dataPoint3D2.index;
                        dataPoint3D6.xPosition = array[j - 1].X;
                        dataPoint3D6.yPosition = array[j - 1].Y;
                        dataPoint3D7.dataPoint = dataPoint3D.dataPoint;
                        dataPoint3D7.index     = dataPoint3D.index;
                        dataPoint3D7.xPosition = array[j].X;
                        dataPoint3D7.yPosition = array[j].Y;
                    }
                    else
                    {
                        dataPoint3D7.dataPoint = dataPoint3D2.dataPoint;
                        dataPoint3D7.index     = dataPoint3D2.index;
                        dataPoint3D7.xPosition = array[j - 1].X;
                        dataPoint3D7.yPosition = array[j - 1].Y;
                        dataPoint3D6.dataPoint = dataPoint3D.dataPoint;
                        dataPoint3D6.index     = dataPoint3D.index;
                        dataPoint3D6.xPosition = array[j].X;
                        dataPoint3D6.yPosition = array[j].Y;
                    }
                    lineSegmentType = LineSegmentType.Middle;
                    if (j == 1)
                    {
                        lineSegmentType = ((!flag) ? LineSegmentType.First : LineSegmentType.Last);
                    }
                    else if (j == array.Length - 1)
                    {
                        lineSegmentType = (flag ? LineSegmentType.First : LineSegmentType.Last);
                    }
                    area.IterationCounter = 0;
                    GraphicsPath graphicsPath2 = Draw3DSurface(dataPoint3D6, dataPoint3D7, flag, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, 0f, operationType, lineSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop: true, clipOnBottom: true);
                    if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                    {
                        graphicsPath.AddPath(graphicsPath2, connect: true);
                    }
                }
                return(graphicsPath);
            }
            return(Draw3DSurface(dataPoint3D2, dataPoint3D, flag, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, LineSegmentType.Single, topDarkening, bottomDarkening, thirdPointPosition, fourthPointPosition, clippedSegment, clipOnTop: true, clipOnBottom: true));
        }
        internal void DrawLabels3D(CommonElements common, ChartGraphics graph, ChartArea area, DataPoint3D pointEx, int pointIndex, Series series, RectangleF rectangle)
        {
            DataPoint    dataPoint = pointEx.dataPoint;
            StringFormat format    = new StringFormat();

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

            graph.Clip = new Region();
            if (dataPoint.ShowLabelAsValue || dataPoint.Label.Length > 0)
            {
                string text;
                if (dataPoint.Label.Length == 0)
                {
                    double value = GetYValue(common, area, series, dataPoint, pointIndex, -2);
                    if (hundredPercentStacked && dataPoint.LabelFormat.Length == 0)
                    {
                        value = Math.Round(value, 2);
                    }
                    text = ValueConverter.FormatValue(series.chart, dataPoint, value, dataPoint.LabelFormat, series.YValueType, ChartElementType.DataPoint);
                }
                else
                {
                    text = dataPoint.ReplaceKeywords(dataPoint.Label);
                    if (series.chart != null && series.chart.LocalizeTextHandler != null)
                    {
                        text = series.chart.LocalizeTextHandler(dataPoint, text, dataPoint.ElementId, ChartElementType.DataPoint);
                    }
                }
                PointF pointF = PointF.Empty;
                pointF.X = rectangle.X + rectangle.Width / 2f;
                pointF.Y = rectangle.Y + rectangle.Height / 2f;
                Point3D[] array = new Point3D[1]
                {
                    new Point3D(pointF.X, pointF.Y, pointEx.zPosition + pointEx.depth)
                };
                area.matrix3D.TransformPoints(array);
                pointF.X = array[0].X;
                pointF.Y = array[0].Y;
                int   angle     = dataPoint.FontAngle;
                SizeF labelSize = SizeF.Empty;
                if (series.SmartLabels.Enabled)
                {
                    labelSize = graph.GetRelativeSize(graph.MeasureString(text, dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                    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.Top | LabelAlignmentTypes.Bottom);
                    }
                    pointF = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, series.SmartLabels, pointF, labelSize, ref format, pointF, new SizeF(0f, 0f), LabelAlignmentTypes.Center);
                    series.SmartLabels.MarkerOverlapping = markerOverlapping;
                    series.SmartLabels.MovingDirection   = movingDirection;
                    angle = 0;
                }
                if (!pointF.IsEmpty)
                {
                    if (labelSize.IsEmpty)
                    {
                        labelSize = graph.GetRelativeSize(graph.MeasureString(text, dataPoint.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic)));
                    }
                    RectangleF empty = RectangleF.Empty;
                    SizeF      sizeF = new SizeF(labelSize.Width, labelSize.Height);
                    sizeF.Height += labelSize.Height / 8f;
                    sizeF.Width  += sizeF.Width / (float)text.Length;
                    graph.DrawPointLabelStringRel(backPosition: new RectangleF(pointF.X - sizeF.Width / 2f, pointF.Y - sizeF.Height / 2f - labelSize.Height / 10f, sizeF.Width, sizeF.Height), common: common, text: text, font: dataPoint.Font, brush: new SolidBrush(dataPoint.FontColor), position: pointF, format: format, angle: angle, backColor: dataPoint.LabelBackColor, borderColor: dataPoint.LabelBorderColor, borderWidth: dataPoint.LabelBorderWidth, borderStyle: dataPoint.LabelBorderStyle, series: series, point: dataPoint, pointIndex: pointIndex);
                }
            }
            graph.Clip = clip;
        }
Exemplo n.º 26
0
        protected override GraphicsPath Draw3DSurface(DataPoint3D firstPoint, DataPoint3D secondPoint, bool reversed, ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, LineSegmentType surfaceSegmentType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment, bool clipOnTop, bool clipOnBottom)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            DataPoint3D dataPoint3D = secondPoint;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                dataPoint3D = firstPoint;
            }
            Color          color       = useBorderColor ? dataPoint3D.dataPoint.BorderColor : dataPoint3D.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D.dataPoint.BorderStyle;

            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            float num  = (float)Math.Round(vAxis.GetPosition(vAxis.Crossing), 3);
            float num2 = (float)Math.Min(firstPoint.xPosition, secondPoint.xPosition);
            float val  = (float)Math.Min(firstPoint.yPosition, secondPoint.yPosition);

            val = Math.Min(val, num);
            float num3 = (float)Math.Max(firstPoint.xPosition, secondPoint.xPosition);
            float val2 = (float)Math.Max(firstPoint.yPosition, secondPoint.yPosition);

            val2 = Math.Max(val2, num);
            RectangleF   position        = new RectangleF(num2, val, num3 - num2, val2 - val);
            SurfaceNames visibleSurfaces = graph.GetVisibleSurfaces(position, positionZ, depth, matrix);
            bool         upSideDown      = false;

            if ((decimal)firstPoint.yPosition >= (decimal)num && (decimal)secondPoint.yPosition >= (decimal)num)
            {
                upSideDown = true;
                bool num4 = (visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag = (visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Top;
                if (num4)
                {
                    visibleSurfaces |= SurfaceNames.Bottom;
                }
                if (flag)
                {
                    visibleSurfaces |= SurfaceNames.Top;
                }
            }
            GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
            GetBottomPointsPosition(common, area, num, ref firstPoint, ref secondPoint, thirdPointPosition, fourthPointPosition, out PointF thirdPoint, out PointF fourthPoint);
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                thirdPoint.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                fourthPoint.Y = fourthPointPosition.Y;
            }
            if (float.IsNaN(thirdPoint.X) || float.IsNaN(thirdPoint.Y) || float.IsNaN(fourthPoint.X) || float.IsNaN(fourthPoint.Y))
            {
                return(graphicsPath);
            }
            if (clipOnTop && ClipTopPoints(graphicsPath, ref firstPoint, ref secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            if (clipOnBottom && ClipBottomPoints(graphicsPath, ref firstPoint, ref secondPoint, ref thirdPoint, ref fourthPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            if ((Math.Round((decimal)firstPoint.yPosition, 3) > (decimal)num + 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) < (decimal)num - 0.001m) || (Math.Round((decimal)firstPoint.yPosition, 3) < (decimal)num - 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) > (decimal)num + 0.001m))
            {
                DataPoint3D axisIntersection = GetAxisIntersection(firstPoint, secondPoint, num);
                for (int i = 0; i <= 1; i++)
                {
                    GraphicsPath graphicsPath2 = null;
                    if ((i == 0 && !reversed) || (i == 1 && reversed))
                    {
                        axisIntersection.dataPoint = secondPoint.dataPoint;
                        axisIntersection.index     = secondPoint.index;
                        graphicsPath2 = Draw3DSurface(firstPoint, axisIntersection, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop, clipOnBottom);
                    }
                    if ((i == 1 && !reversed) || (i == 0 && reversed))
                    {
                        axisIntersection.dataPoint = firstPoint.dataPoint;
                        axisIntersection.index     = firstPoint.index;
                        graphicsPath2 = Draw3DSurface(axisIntersection, secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop, clipOnBottom);
                    }
                    if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                    {
                        graphicsPath.AddPath(graphicsPath2, connect: true);
                    }
                }
                return(graphicsPath);
            }
            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            for (int j = 1; j <= 2; j++)
            {
                SurfaceNames[] obj = new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Bottom,
                    SurfaceNames.Top,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                };
                LineSegmentType lineSegmentType = LineSegmentType.Middle;
                SurfaceNames[]  array           = obj;
                foreach (SurfaceNames surfaceNames in array)
                {
                    if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames, visibleSurfaces, color, points, firstPoint, secondPoint, multiSeries, reversed, ref lineSegmentType) != j || (allPointsLoopsNumber == 2 && (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement && ((pointLoopIndex == 0 && (surfaceNames == SurfaceNames.Front || (j == 2 && (surfaceNames == SurfaceNames.Left || surfaceNames == SurfaceNames.Right)))) || (pointLoopIndex == 1 && (surfaceNames == SurfaceNames.Back || surfaceNames != SurfaceNames.Front) && (j == 1 || (surfaceNames != SurfaceNames.Left && surfaceNames != SurfaceNames.Right))))))
                    {
                        continue;
                    }
                    Color color2 = color;
                    Color color3 = dataPoint3D.dataPoint.BorderColor;
                    if (j == 1)
                    {
                        if (color2.A == byte.MaxValue)
                        {
                            continue;
                        }
                        color2 = Color.Transparent;
                        if (color3 == Color.Empty)
                        {
                            color3 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                        }
                    }
                    bool flag2 = showPointLines;
                    if (surfaceSegmentType == LineSegmentType.Middle)
                    {
                        flag2 = false;
                    }
                    if (clippedSegment && surfaceNames != SurfaceNames.Top && surfaceNames != SurfaceNames.Bottom)
                    {
                        continue;
                    }
                    GraphicsPath graphicsPath3 = null;
                    switch (surfaceNames)
                    {
                    case SurfaceNames.Top:
                    {
                        Color backColor   = (topDarkening == 0f) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, topDarkening);
                        Color borderColor = (topDarkening == 0f) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, topDarkening);
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, borderColor, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, 0f, operationType, surfaceSegmentType, flag2, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;
                    }

                    case SurfaceNames.Bottom:
                    {
                        DataPoint3D dataPoint3D12 = new DataPoint3D();
                        dataPoint3D12.index     = firstPoint.index;
                        dataPoint3D12.dataPoint = firstPoint.dataPoint;
                        dataPoint3D12.xPosition = firstPoint.xPosition;
                        dataPoint3D12.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D13 = new DataPoint3D();
                        dataPoint3D13.index     = secondPoint.index;
                        dataPoint3D13.dataPoint = secondPoint.dataPoint;
                        dataPoint3D13.xPosition = secondPoint.xPosition;
                        dataPoint3D13.yPosition = fourthPoint.Y;
                        Color backColor2   = (bottomDarkening == 0f) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, topDarkening);
                        Color borderColor2 = (bottomDarkening == 0f) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, topDarkening);
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor2, borderColor2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D12, dataPoint3D13, points, pointIndex, 0f, operationType, surfaceSegmentType, flag2, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;
                    }

                    case SurfaceNames.Left:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last))
                        {
                            DataPoint3D dataPoint3D4 = (firstPoint.xPosition <= secondPoint.xPosition) ? firstPoint : secondPoint;
                            DataPoint3D dataPoint3D5 = new DataPoint3D();
                            dataPoint3D5.index     = dataPoint3D4.index;
                            dataPoint3D5.dataPoint = dataPoint3D4.dataPoint;
                            dataPoint3D5.xPosition = dataPoint3D4.xPosition;
                            dataPoint3D5.yPosition = ((firstPoint.xPosition <= secondPoint.xPosition) ? thirdPoint.Y : fourthPoint.Y);
                            DataPoint3D dataPoint3D6 = new DataPoint3D();
                            dataPoint3D6.index     = dataPoint3D4.index;
                            dataPoint3D6.dataPoint = dataPoint3D4.dataPoint;
                            dataPoint3D6.xPosition = dataPoint3D4.xPosition;
                            dataPoint3D6.yPosition = dataPoint3D4.yPosition;
                            graphicsPath3          = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D5, dataPoint3D6, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: true, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Right:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First))
                        {
                            DataPoint3D dataPoint3D9  = (secondPoint.xPosition >= firstPoint.xPosition) ? secondPoint : firstPoint;
                            DataPoint3D dataPoint3D10 = new DataPoint3D();
                            dataPoint3D10.index     = dataPoint3D9.index;
                            dataPoint3D10.dataPoint = dataPoint3D9.dataPoint;
                            dataPoint3D10.xPosition = dataPoint3D9.xPosition;
                            dataPoint3D10.yPosition = ((secondPoint.xPosition >= firstPoint.xPosition) ? fourthPoint.Y : thirdPoint.Y);
                            DataPoint3D dataPoint3D11 = new DataPoint3D();
                            dataPoint3D11.index     = dataPoint3D9.index;
                            dataPoint3D11.dataPoint = dataPoint3D9.dataPoint;
                            dataPoint3D11.xPosition = dataPoint3D9.xPosition;
                            dataPoint3D11.yPosition = dataPoint3D9.yPosition;
                            graphicsPath3           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D10, dataPoint3D11, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: true, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Back:
                    {
                        DataPoint3D dataPoint3D7 = new DataPoint3D();
                        dataPoint3D7.index     = firstPoint.index;
                        dataPoint3D7.dataPoint = firstPoint.dataPoint;
                        dataPoint3D7.xPosition = firstPoint.xPosition;
                        dataPoint3D7.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D8 = new DataPoint3D();
                        dataPoint3D8.index     = secondPoint.index;
                        dataPoint3D8.dataPoint = secondPoint.dataPoint;
                        dataPoint3D8.xPosition = secondPoint.xPosition;
                        dataPoint3D8.yPosition = fourthPoint.Y;
                        SurfaceNames thinBorders2 = (SurfaceNames)0;
                        if (flag2)
                        {
                            switch (surfaceSegmentType)
                            {
                            case LineSegmentType.Single:
                                thinBorders2 = (SurfaceNames.Left | SurfaceNames.Right);
                                break;

                            case LineSegmentType.First:
                                thinBorders2 = SurfaceNames.Left;
                                break;

                            case LineSegmentType.Last:
                                thinBorders2 = SurfaceNames.Right;
                                break;
                            }
                        }
                        graphicsPath3 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames, positionZ, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D8, dataPoint3D7, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders2);
                        break;
                    }

                    case SurfaceNames.Front:
                    {
                        DataPoint3D dataPoint3D2 = new DataPoint3D();
                        dataPoint3D2.index     = firstPoint.index;
                        dataPoint3D2.dataPoint = firstPoint.dataPoint;
                        dataPoint3D2.xPosition = firstPoint.xPosition;
                        dataPoint3D2.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D3 = new DataPoint3D();
                        dataPoint3D3.index     = secondPoint.index;
                        dataPoint3D3.dataPoint = secondPoint.dataPoint;
                        dataPoint3D3.xPosition = secondPoint.xPosition;
                        dataPoint3D3.yPosition = fourthPoint.Y;
                        if (area.reverseSeriesOrder)
                        {
                            switch (lineSegmentType)
                            {
                            case LineSegmentType.First:
                                lineSegmentType = LineSegmentType.Last;
                                break;

                            case LineSegmentType.Last:
                                lineSegmentType = LineSegmentType.First;
                                break;
                            }
                        }
                        if (surfaceSegmentType != 0 && (surfaceSegmentType == LineSegmentType.Middle || (surfaceSegmentType == LineSegmentType.First && lineSegmentType != LineSegmentType.First) || (surfaceSegmentType == LineSegmentType.Last && lineSegmentType != LineSegmentType.Last)))
                        {
                            lineSegmentType = LineSegmentType.Middle;
                        }
                        SurfaceNames thinBorders = (SurfaceNames)0;
                        if (flag2)
                        {
                            switch (surfaceSegmentType)
                            {
                            case LineSegmentType.Single:
                                thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                                break;

                            case LineSegmentType.First:
                                thinBorders = SurfaceNames.Left;
                                break;

                            case LineSegmentType.Last:
                                thinBorders = SurfaceNames.Right;
                                break;
                            }
                        }
                        graphicsPath3 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames, positionZ + depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D3, dataPoint3D2, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders);
                        break;
                    }
                    }
                    if (j == 2 && graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                    {
                        graphicsPath.CloseFigure();
                        graphicsPath.SetMarkers();
                        graphicsPath.AddPath(graphicsPath3, connect: true);
                    }
                }
            }
            return(graphicsPath);
        }
Exemplo n.º 27
0
        internal void ProcessSinglePoint3D(DataPoint3D pointEx, bool selection, ChartGraphics graph, CommonElements common, ChartArea area)
        {
            DataPoint dataPoint = pointEx.dataPoint;
            Series    series    = dataPoint.series;

            dataPoint.positionRel = new PointF(float.NaN, float.NaN);
            hAxis = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName);
            vAxis = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName);
            double yValue = GetYValue(common, area, series, pointEx.dataPoint, pointEx.index - 1, yValueIndex);

            yValue = vAxis.GetLogValue(yValue);
            if (yValue > vAxis.GetViewMaximum() || yValue < vAxis.GetViewMinimum())
            {
                return;
            }
            double yValue2 = pointEx.indexedSeries ? ((double)pointEx.index) : dataPoint.XValue;

            yValue2 = hAxis.GetLogValue(yValue2);
            if (yValue2 > hAxis.GetViewMaximum() || yValue2 < hAxis.GetViewMinimum() || (!ShouldDrawMarkerOnViewEdgeX() && ((yValue2 == hAxis.GetViewMaximum() && ShiftedX >= 0.0) || (yValue2 == hAxis.GetViewMinimum() && ShiftedX <= 0.0))))
            {
                return;
            }
            PointF empty = PointF.Empty;

            empty.Y  = (float)pointEx.yPosition;
            empty.X  = (float)hAxis.GetLinearPosition(yValue2);
            empty.X += (float)ShiftedX;
            dataPoint.positionRel = new PointF(empty.X, empty.Y);
            int         markerSize  = dataPoint.MarkerSize;
            string      markerImage = dataPoint.MarkerImage;
            MarkerStyle markerStyle = dataPoint.MarkerStyle;
            SizeF       markerSize2 = GetMarkerSize(graph, common, area, dataPoint, markerSize, markerImage);

            Point3D[] array = new Point3D[1]
            {
                new Point3D(empty.X, empty.Y, pointEx.zPosition + (middleMarker ? (pointEx.depth / 2f) : pointEx.depth))
            };
            area.matrix3D.TransformPoints(array);
            PointF       pointF = array[0].PointF;
            GraphicsPath path   = null;

            if ((alwaysDrawMarkers || markerStyle != 0 || markerImage.Length > 0) && pointEx.index % series.MarkerStep == 0)
            {
                DrawingOperationTypes drawingOperationTypes = DrawingOperationTypes.DrawElement;
                if (common.ProcessModeRegions)
                {
                    drawingOperationTypes |= DrawingOperationTypes.CalcElementPath;
                }
                graph.StartHotRegion(dataPoint);
                graph.StartAnimation();
                path = graph.DrawMarker3D(area.matrix3D, area.Area3DStyle.Light, pointEx.zPosition + (middleMarker ? (pointEx.depth / 2f) : pointEx.depth), empty, (markerStyle == MarkerStyle.None) ? MarkerStyle.Circle : markerStyle, (int)markerSize2.Height, (dataPoint.MarkerColor == Color.Empty) ? dataPoint.Color : dataPoint.MarkerColor, (dataPoint.MarkerBorderColor == Color.Empty) ? dataPoint.BorderColor : dataPoint.MarkerBorderColor, GetMarkerBorderSize(dataPoint), markerImage, dataPoint.MarkerImageTransparentColor, (dataPoint.series != null) ? dataPoint.series.ShadowOffset : 0, (dataPoint.series != null) ? dataPoint.series.ShadowColor : Color.Empty, new RectangleF(pointF.X, pointF.Y, markerSize2.Width, markerSize2.Height), drawingOperationTypes);
                graph.StopAnimation();
                graph.EndHotRegion();
            }
            PointF empty2 = PointF.Empty;

            if (label3DInfoList != null && label3DInfoList.Count > 0 && ((Label3DInfo)label3DInfoList[label3DInfoList.Count - 1]).PointEx.zPosition != pointEx.zPosition)
            {
                DrawAccumulated3DLabels(graph, common, area);
            }
            if (label3DInfoList == null)
            {
                label3DInfoList = new ArrayList();
            }
            Label3DInfo label3DInfo = new Label3DInfo();

            label3DInfo.PointEx        = pointEx;
            label3DInfo.MarkerPosition = pointF;
            label3DInfo.MarkerSize     = markerSize2;
            label3DInfo.AnimatedPoint  = empty2;
            label3DInfoList.Add(label3DInfo);
            if (common.ProcessModeRegions)
            {
                SizeF relativeSize = graph.GetRelativeSize(markerSize2);
                int   insertIndex  = common.HotRegionsList.FindInsertIndex();
                if (markerStyle == MarkerStyle.Circle)
                {
                    float[] array2 = new float[3]
                    {
                        pointF.X,
                        pointF.Y,
                        relativeSize.Width / 2f
                    };
                    common.HotRegionsList.AddHotRegion(insertIndex, graph, array2[0], array2[1], array2[2], dataPoint, series.Name, pointEx.index - 1);
                }
                if (markerStyle == MarkerStyle.Square)
                {
                    common.HotRegionsList.AddHotRegion(path, relativePath: false, graph, dataPoint, series.Name, pointEx.index - 1);
                }
                else
                {
                    common.HotRegionsList.AddHotRegion(graph, new RectangleF(pointF.X - relativeSize.Width / 2f, pointF.Y - relativeSize.Height / 2f, relativeSize.Width, relativeSize.Height), dataPoint, series.Name, pointEx.index - 1);
                }
            }
        }
Exemplo n.º 28
0
 protected virtual void GetBottomPointsPosition(CommonElements common, ChartArea area, float axisPosition, ref DataPoint3D firstPoint, ref DataPoint3D secondPoint, PointF thirdPointPosition, PointF fourthPointPosition, out PointF thirdPoint, out PointF fourthPoint)
 {
     thirdPoint  = new PointF((float)firstPoint.xPosition, axisPosition);
     fourthPoint = new PointF((float)secondPoint.xPosition, axisPosition);
 }
Exemplo n.º 29
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (base.centerPointIndex == 2147483647)
            {
                base.centerPointIndex = base.GetCenterPointIndex(points);
            }
            DataPoint3D dataPoint3D  = (DataPoint3D)points[pointIndex];
            int         num          = pointIndex;
            DataPoint3D dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, base.multiSeries ? dataPoint3D : null, ref num);
            DataPoint3D dataPoint3D3 = dataPoint3D;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D3 = prevDataPointEx;
            }
            else if (dataPoint3D2.index > dataPoint3D.index)
            {
                dataPoint3D3 = dataPoint3D2;
            }
            Color          color       = base.useBorderColor ? dataPoint3D3.dataPoint.BorderColor : dataPoint3D3.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D3.dataPoint.BorderStyle;

            if (dataPoint3D3.dataPoint.Empty && dataPoint3D3.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (dataPoint3D3.dataPoint.Empty && dataPoint3D3.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            if (this.currentKagiDirection == 0)
            {
                this.kagiUpColor = dataPoint3D.dataPoint.series.Color;
                string         text           = ((DataPointAttributes)dataPoint3D.dataPoint.series)["PriceUpColor"];
                ColorConverter colorConverter = new ColorConverter();
                if (text != null)
                {
                    try
                    {
                        this.kagiUpColor = (Color)colorConverter.ConvertFromString(null, CultureInfo.InvariantCulture, text);
                    }
                    catch
                    {
                        throw new InvalidOperationException(SR.ExceptionKagiAttributeFormatInvalid("Up Brick color"));
                    }
                }
                this.currentKagiDirection = ((dataPoint3D2.yPosition > dataPoint3D.yPosition) ? 1 : (-1));
            }
            Color       backColor    = (this.currentKagiDirection == 1) ? this.kagiUpColor : color;
            DataPoint3D dataPoint3D4 = new DataPoint3D();

            dataPoint3D4.xPosition = dataPoint3D.xPosition;
            dataPoint3D4.yPosition = dataPoint3D2.yPosition;
            bool flag = true;

            if (pointIndex + 1 < points.Count)
            {
                DataPoint3D dataPoint3D5 = (DataPoint3D)points[pointIndex + 1];
                if (dataPoint3D5.index == dataPoint3D2.index)
                {
                    flag = false;
                }
            }
            if (base.centerPointIndex != 2147483647 && pointIndex >= base.centerPointIndex)
            {
                flag = false;
            }
            DataPoint3D dataPoint3D6 = null;

            if (dataPoint3D.index >= 2)
            {
                int num2 = (dataPoint3D2.yPosition > dataPoint3D.yPosition) ? 1 : (-1);
                if (num2 != this.currentKagiDirection)
                {
                    DataPoint3D dataPoint3D7 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 2, base.multiSeries ? dataPoint3D : null, ref num);
                    bool        flag2        = false;
                    if (dataPoint3D2.yPosition > dataPoint3D7.yPosition && dataPoint3D2.yPosition > dataPoint3D.yPosition && dataPoint3D7.yPosition > dataPoint3D.yPosition)
                    {
                        flag2 = true;
                    }
                    else if (dataPoint3D2.yPosition < dataPoint3D7.yPosition && dataPoint3D2.yPosition < dataPoint3D.yPosition && dataPoint3D7.yPosition < dataPoint3D.yPosition)
                    {
                        flag2 = true;
                    }
                    if (flag2)
                    {
                        dataPoint3D6           = new DataPoint3D();
                        dataPoint3D6.xPosition = dataPoint3D.xPosition;
                        dataPoint3D6.yPosition = dataPoint3D7.yPosition;
                        dataPoint3D6.dataPoint = dataPoint3D.dataPoint;
                    }
                }
            }
            GraphicsPath[] array = new GraphicsPath[3];
            for (int i = 0; i < 2; i++)
            {
                DataPoint3D     firstPoint      = dataPoint3D2;
                DataPoint3D     secondPoint     = dataPoint3D;
                LineSegmentType lineSegmentType = LineSegmentType.First;
                switch (i)
                {
                case 0:
                    lineSegmentType        = (LineSegmentType)(flag ? 1 : 3);
                    dataPoint3D4.dataPoint = (flag ? dataPoint3D.dataPoint : dataPoint3D2.dataPoint);
                    firstPoint             = (flag ? dataPoint3D2 : dataPoint3D4);
                    secondPoint            = (flag ? dataPoint3D4 : dataPoint3D);
                    break;

                case 1:
                    lineSegmentType        = (LineSegmentType)((!flag) ? 1 : 3);
                    dataPoint3D4.dataPoint = ((!flag) ? dataPoint3D.dataPoint : dataPoint3D.dataPoint);
                    firstPoint             = ((!flag) ? dataPoint3D2 : dataPoint3D4);
                    secondPoint            = ((!flag) ? dataPoint3D4 : dataPoint3D);
                    break;
                }
                if (lineSegmentType == LineSegmentType.First || dataPoint3D6 == null)
                {
                    array[i] = new GraphicsPath();
                    array[i] = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, 0f, operationType, lineSegmentType, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                }
                else
                {
                    if (!flag)
                    {
                        backColor = ((this.currentKagiDirection == -1) ? this.kagiUpColor : color);
                    }
                    array[i]                  = new GraphicsPath();
                    array[i]                  = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, firstPoint, dataPoint3D6, points, pointIndex, 0f, operationType, LineSegmentType.Middle, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                    graph.frontLinePen        = null;
                    this.currentKagiDirection = ((this.currentKagiDirection != 1) ? 1 : (-1));
                    backColor                 = ((!flag) ? ((this.currentKagiDirection == -1) ? this.kagiUpColor : color) : ((this.currentKagiDirection == 1) ? this.kagiUpColor : color));
                    array[2]                  = new GraphicsPath();
                    array[2]                  = graph.Draw3DSurface(area, matrix, lightStyle, SurfaceNames.Top, positionZ, depth, backColor, dataPoint3D3.dataPoint.BorderColor, dataPoint3D3.dataPoint.BorderWidth, borderStyle, dataPoint3D6, secondPoint, points, pointIndex, 0f, operationType, lineSegmentType, (byte)(base.showPointLines ? 1 : 0) != 0, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                    if (!flag)
                    {
                        backColor = ((this.currentKagiDirection == 1) ? this.kagiUpColor : color);
                    }
                }
                graph.frontLinePen = null;
            }
            if (graphicsPath != null)
            {
                if (array[0] != null)
                {
                    graphicsPath.AddPath(array[0], true);
                }
                if (array[1] != null)
                {
                    graphicsPath.AddPath(array[1], true);
                }
                if (array[2] != null)
                {
                    graphicsPath.AddPath(array[2], true);
                }
            }
            return(graphicsPath);
        }
Exemplo n.º 30
0
        protected override GraphicsPath Draw3DSurface(ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;

            if (base.centerPointIndex == 2147483647)
            {
                base.centerPointIndex = base.GetCenterPointIndex(points);
            }
            DataPoint3D dataPoint3D  = (DataPoint3D)points[pointIndex];
            int         num          = pointIndex;
            DataPoint3D dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, base.multiSeries ? dataPoint3D : null, ref num);
            bool        flag         = false;

            if (dataPoint3D2.index > dataPoint3D.index)
            {
                DataPoint3D dataPoint3D3 = dataPoint3D2;
                dataPoint3D2 = dataPoint3D;
                dataPoint3D  = dataPoint3D3;
                flag         = true;
            }
            if (matrix.perspective != 0.0 && base.centerPointIndex != 2147483647)
            {
                num = pointIndex;
                if (pointIndex != base.centerPointIndex + 1)
                {
                    dataPoint3D2 = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, base.multiSeries ? dataPoint3D : null, ref num);
                }
                else if (!area.reverseSeriesOrder)
                {
                    dataPoint3D = ChartGraphics3D.FindPointByIndex(points, dataPoint3D2.index + 1, base.multiSeries ? dataPoint3D : null, ref num);
                }
                else
                {
                    dataPoint3D2 = dataPoint3D;
                    dataPoint3D  = ChartGraphics3D.FindPointByIndex(points, dataPoint3D.index - 1, base.multiSeries ? dataPoint3D : null, ref num);
                }
            }
            if (dataPoint3D2 != null && dataPoint3D != null)
            {
                DataPoint3D dataPoint3D4 = dataPoint3D;
                if (prevDataPointEx.dataPoint.Empty)
                {
                    dataPoint3D4 = prevDataPointEx;
                }
                else if (dataPoint3D2.index > dataPoint3D.index)
                {
                    dataPoint3D4 = dataPoint3D2;
                }
                if (!base.useBorderColor)
                {
                    Color color = dataPoint3D4.dataPoint.Color;
                }
                else
                {
                    Color borderColor = dataPoint3D4.dataPoint.BorderColor;
                }
                ChartDashStyle borderStyle = dataPoint3D4.dataPoint.BorderStyle;
                if (dataPoint3D4.dataPoint.Empty && dataPoint3D4.dataPoint.Color == Color.Empty)
                {
                    Color gray = Color.Gray;
                }
                if (dataPoint3D4.dataPoint.Empty)
                {
                    ChartDashStyle borderStyle2 = dataPoint3D4.dataPoint.BorderStyle;
                }
                flag = false;
                for (int i = 1; pointIndex + i < points.Count; i++)
                {
                    DataPoint3D dataPoint3D5 = (DataPoint3D)points[pointIndex + i];
                    if (dataPoint3D5.dataPoint.series.Name == dataPoint3D2.dataPoint.series.Name)
                    {
                        if (dataPoint3D5.index == dataPoint3D2.index)
                        {
                            flag = true;
                        }
                        break;
                    }
                }
                if (tension != 0.0)
                {
                    GraphicsPath splineFlattenPath = graph.GetSplineFlattenPath(area, matrix, positionZ, depth, dataPoint3D2, dataPoint3D, points, pointIndex, tension, true, false, 0);
                    PointF[]     array             = null;
                    flag = (pointIndex < num);
                    if (flag)
                    {
                        splineFlattenPath.Reverse();
                    }
                    array = splineFlattenPath.PathPoints;
                    DataPoint3D     dataPoint3D6    = new DataPoint3D();
                    DataPoint3D     dataPoint3D7    = new DataPoint3D();
                    LineSegmentType lineSegmentType = LineSegmentType.Middle;
                    for (int j = 1; j < array.Length; j++)
                    {
                        if (!flag)
                        {
                            dataPoint3D6.dataPoint = dataPoint3D2.dataPoint;
                            dataPoint3D6.index     = dataPoint3D2.index;
                            dataPoint3D6.xPosition = (double)array[j - 1].X;
                            dataPoint3D6.yPosition = (double)array[j - 1].Y;
                            dataPoint3D7.dataPoint = dataPoint3D.dataPoint;
                            dataPoint3D7.index     = dataPoint3D.index;
                            dataPoint3D7.xPosition = (double)array[j].X;
                            dataPoint3D7.yPosition = (double)array[j].Y;
                        }
                        else
                        {
                            dataPoint3D7.dataPoint = dataPoint3D2.dataPoint;
                            dataPoint3D7.index     = dataPoint3D2.index;
                            dataPoint3D7.xPosition = (double)array[j - 1].X;
                            dataPoint3D7.yPosition = (double)array[j - 1].Y;
                            dataPoint3D6.dataPoint = dataPoint3D.dataPoint;
                            dataPoint3D6.index     = dataPoint3D.index;
                            dataPoint3D6.xPosition = (double)array[j].X;
                            dataPoint3D6.yPosition = (double)array[j].Y;
                        }
                        lineSegmentType = LineSegmentType.Middle;
                        if (j == 1)
                        {
                            lineSegmentType = (LineSegmentType)((!flag) ? 1 : 3);
                        }
                        else if (j == array.Length - 1)
                        {
                            lineSegmentType = (LineSegmentType)(flag ? 1 : 3);
                        }
                        area.IterationCounter = 0;
                        GraphicsPath graphicsPath2 = this.Draw3DSurface(dataPoint3D6, dataPoint3D7, flag, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, 0f, operationType, lineSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, true, true);
                        if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                        {
                            graphicsPath.AddPath(graphicsPath2, true);
                        }
                    }
                    return(graphicsPath);
                }
                return(this.Draw3DSurface(dataPoint3D2, dataPoint3D, flag, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, LineSegmentType.Single, topDarkening, bottomDarkening, thirdPointPosition, fourthPointPosition, clippedSegment, true, true));
            }
            return(graphicsPath);
        }