Ejemplo n.º 1
0
        protected virtual RadarDrawingStyle GetDrawingStyle(Series ser, DataPoint point)
        {
            RadarDrawingStyle result = RadarDrawingStyle.Area;

            if (point.IsAttributeSet("RadarDrawingStyle") || ser.IsAttributeSet("RadarDrawingStyle"))
            {
                string text = point.IsAttributeSet("RadarDrawingStyle") ? point["RadarDrawingStyle"] : ser["RadarDrawingStyle"];
                if (string.Compare(text, "Area", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    result = RadarDrawingStyle.Area;
                }
                else if (string.Compare(text, "Line", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    result = RadarDrawingStyle.Line;
                }
                else
                {
                    if (string.Compare(text, "Marker", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(text, "RadarDrawingStyle"));
                    }
                    result = RadarDrawingStyle.Marker;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets polar chart drawing style.
        /// </summary>
        /// <param name="ser">Chart series.</param>
        /// <param name="point">Series point.</param>
        /// <returns>Returns polar drawing style.</returns>
        override protected RadarDrawingStyle GetDrawingStyle(Series ser, DataPoint point)
        {
            RadarDrawingStyle drawingStyle = RadarDrawingStyle.Line;

            if (point.IsCustomPropertySet(CustomPropertyName.PolarDrawingStyle) ||
                ser.IsCustomPropertySet(CustomPropertyName.PolarDrawingStyle))
            {
                string attributeValue =
                    (point.IsCustomPropertySet(CustomPropertyName.PolarDrawingStyle)) ?
                    point[CustomPropertyName.PolarDrawingStyle] :
                    ser[CustomPropertyName.PolarDrawingStyle];
                if (String.Compare(attributeValue, "Line", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    drawingStyle = RadarDrawingStyle.Line;
                }
                else if (String.Compare(attributeValue, "Marker", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    drawingStyle = RadarDrawingStyle.Marker;
                }
                else
                {
                    throw(new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(attributeValue, "PolarDrawingStyle")));
                }
            }
            return(drawingStyle);
        }
Ejemplo n.º 3
0
        protected virtual RadarDrawingStyle GetDrawingStyle(Series ser, DataPoint point)
        {
            RadarDrawingStyle result = RadarDrawingStyle.Area;

            if (!point.IsAttributeSet("RadarDrawingStyle") && !ser.IsAttributeSet("RadarDrawingStyle"))
            {
                goto IL_0089;
            }
            string text = point.IsAttributeSet("RadarDrawingStyle") ? ((DataPointAttributes)point)["RadarDrawingStyle"] : ((DataPointAttributes)ser)["RadarDrawingStyle"];

            if (string.Compare(text, "Area", StringComparison.OrdinalIgnoreCase) == 0)
            {
                result = RadarDrawingStyle.Area;
                goto IL_0089;
            }
            if (string.Compare(text, "Line", StringComparison.OrdinalIgnoreCase) == 0)
            {
                result = RadarDrawingStyle.Line;
                goto IL_0089;
            }
            if (string.Compare(text, "Marker", StringComparison.OrdinalIgnoreCase) == 0)
            {
                result = RadarDrawingStyle.Marker;
                goto IL_0089;
            }
            throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(text, "RadarDrawingStyle"));
IL_0089:
            return(result);
        }
Ejemplo n.º 4
0
        public void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list)
        {
            PointF[] pointsPosition = this.GetPointsPosition(common.graph, area, series);
            int      num            = 0;
            int      num2           = 0;

            foreach (DataPoint point in series.Points)
            {
                Color             color        = point.MarkerColor;
                MarkerStyle       markerStyle  = point.MarkerStyle;
                RadarDrawingStyle drawingStyle = this.GetDrawingStyle(series, point);
                if (drawingStyle == RadarDrawingStyle.Marker)
                {
                    color = point.Color;
                }
                SizeF size = this.GetMarkerSize(common.graph, common, area, point, point.MarkerSize, point.MarkerImage);
                if (markerStyle != 0 || point.MarkerImage.Length > 0)
                {
                    if (color.IsEmpty)
                    {
                        color = point.Color;
                    }
                    if (num == 0)
                    {
                        PointF relativePoint = common.graph.GetRelativePoint(pointsPosition[num2]);
                        size = common.graph.GetRelativeSize(size);
                        RectangleF rectangleF = new RectangleF((float)(relativePoint.X - size.Width / 2.0), (float)(relativePoint.Y - size.Height / 2.0), size.Width, size.Height);
                        list.Add(rectangleF);
                    }
                    num++;
                    if (series.MarkerStep == num)
                    {
                        num = 0;
                    }
                }
                num2++;
            }
        }
Ejemplo n.º 5
0
        protected virtual void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw)
        {
            foreach (Series item in common.DataManager.Series)
            {
                if (item.ChartArea != area.Name || !item.IsVisible())
                {
                    continue;
                }
                if (string.Compare(item.ChartTypeName, Name, ignoreCase: true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new InvalidOperationException(SR.ExceptionChartTypeCanNotCombine(item.ChartTypeName, Name));
                }
                if (!selection)
                {
                    common.EventsManager.OnBackPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition));
                }
                Axis     axis           = area.GetAxis(AxisName.Y, AxisType.Primary, item.YSubAxisName);
                double   viewMinimum    = axis.GetViewMinimum();
                double   viewMaximum    = axis.GetViewMaximum();
                PointF[] pointsPosition = GetPointsPosition(graph, area, item);
                int      num            = 0;
                if (item.ShadowOffset != 0 && !selection)
                {
                    graph.shadowDrawingMode = true;
                    foreach (DataPoint point in item.Points)
                    {
                        int num2 = num + 1;
                        if (num2 >= item.Points.Count)
                        {
                            num2 = 0;
                        }
                        DataPointAttributes dataPointAttributes = point;
                        if (item.Points[num2].Empty)
                        {
                            dataPointAttributes = item.Points[num2];
                        }
                        Color left = dataPointAttributes.Color;
                        _ = dataPointAttributes.BorderColor;
                        int               borderWidth  = dataPointAttributes.BorderWidth;
                        ChartDashStyle    borderStyle  = dataPointAttributes.BorderStyle;
                        RadarDrawingStyle drawingStyle = GetDrawingStyle(item, point);
                        if (axis.GetLogValue(point.YValues[0]) > viewMaximum || axis.GetLogValue(point.YValues[0]) < viewMinimum || axis.GetLogValue(item.Points[num2].YValues[0]) > viewMaximum || axis.GetLogValue(item.Points[num2].YValues[0]) < viewMinimum)
                        {
                            num++;
                            continue;
                        }
                        switch (drawingStyle)
                        {
                        case RadarDrawingStyle.Line:
                            _           = dataPointAttributes.Color;
                            borderWidth = ((borderWidth < 1) ? 1 : borderWidth);
                            borderStyle = ((borderStyle == ChartDashStyle.NotSet) ? ChartDashStyle.Solid : borderStyle);
                            left        = Color.Transparent;
                            break;

                        case RadarDrawingStyle.Marker:
                            left = Color.Transparent;
                            break;
                        }
                        if (num2 == 0 && !RequireClosedFigure() && drawingStyle != 0)
                        {
                            break;
                        }
                        if (left != Color.Transparent && left != Color.Empty && item.ShadowOffset != 0)
                        {
                            GraphicsPath graphicsPath = new GraphicsPath();
                            graphicsPath.AddLine(graph.GetAbsolutePoint(area.circularCenter), pointsPosition[num]);
                            graphicsPath.AddLine(pointsPosition[num], pointsPosition[num2]);
                            graphicsPath.AddLine(pointsPosition[num2], graph.GetAbsolutePoint(area.circularCenter));
                            Matrix matrix = new Matrix();
                            matrix.Translate(item.ShadowOffset, item.ShadowOffset);
                            graphicsPath.Transform(matrix);
                            graph.FillPath(new SolidBrush(item.ShadowColor), graphicsPath);
                        }
                        num++;
                    }
                    graph.shadowDrawingMode = false;
                }
                num = 0;
                foreach (DataPoint point2 in item.Points)
                {
                    point2.positionRel = graph.GetRelativePoint(pointsPosition[num]);
                    int num3 = num + 1;
                    if (num3 >= item.Points.Count)
                    {
                        num3 = 0;
                    }
                    DataPointAttributes dataPointAttributes2 = point2;
                    if (item.Points[num3].Empty)
                    {
                        dataPointAttributes2 = item.Points[num3];
                    }
                    Color             color          = dataPointAttributes2.Color;
                    Color             color2         = dataPointAttributes2.BorderColor;
                    int               num4           = dataPointAttributes2.BorderWidth;
                    ChartDashStyle    chartDashStyle = dataPointAttributes2.BorderStyle;
                    RadarDrawingStyle drawingStyle2  = GetDrawingStyle(item, point2);
                    if (axis.GetLogValue(point2.YValues[0]) > viewMaximum || axis.GetLogValue(point2.YValues[0]) < viewMinimum || axis.GetLogValue(item.Points[num3].YValues[0]) > viewMaximum || axis.GetLogValue(item.Points[num3].YValues[0]) < viewMinimum)
                    {
                        num++;
                        continue;
                    }
                    switch (drawingStyle2)
                    {
                    case RadarDrawingStyle.Line:
                        color2         = dataPointAttributes2.Color;
                        num4           = ((num4 < 1) ? 1 : num4);
                        chartDashStyle = ((chartDashStyle == ChartDashStyle.NotSet) ? ChartDashStyle.Solid : chartDashStyle);
                        color          = Color.Transparent;
                        break;

                    case RadarDrawingStyle.Marker:
                        color = Color.Transparent;
                        break;
                    }
                    GraphicsPath graphicsPath2 = new GraphicsPath();
                    if (num3 == 0 && !RequireClosedFigure() && drawingStyle2 != 0)
                    {
                        if (common.ProcessModeRegions)
                        {
                            AddSelectionPath(area, graphicsPath2, pointsPosition, num, num3, graph.GetAbsolutePoint(area.circularCenter), 0);
                            int insertIndex = common.HotRegionsList.FindInsertIndex();
                            common.HotRegionsList.AddHotRegion(insertIndex, graphicsPath2, relativePath: false, graph, point2, item.Name, num);
                        }
                        break;
                    }
                    if (color != Color.Transparent && color != Color.Empty)
                    {
                        GraphicsPath graphicsPath3 = new GraphicsPath();
                        graphicsPath3.AddLine(graph.GetAbsolutePoint(area.circularCenter), pointsPosition[num]);
                        graphicsPath3.AddLine(pointsPosition[num], pointsPosition[num3]);
                        graphicsPath3.AddLine(pointsPosition[num3], graph.GetAbsolutePoint(area.circularCenter));
                        if (common.ProcessModePaint)
                        {
                            Brush brush = graph.CreateBrush(graphicsPath3.GetBounds(), color, dataPointAttributes2.BackHatchStyle, dataPointAttributes2.BackImage, dataPointAttributes2.BackImageMode, dataPointAttributes2.BackImageTransparentColor, dataPointAttributes2.BackImageAlign, dataPointAttributes2.BackGradientType, dataPointAttributes2.BackGradientEndColor);
                            graph.StartHotRegion(point2);
                            graph.StartAnimation();
                            graph.FillPath(brush, graphicsPath3);
                            graph.StopAnimation();
                            graph.EndHotRegion();
                        }
                        if (common.ProcessModeRegions)
                        {
                            AddSelectionPath(area, graphicsPath2, pointsPosition, num, num3, graph.GetAbsolutePoint(area.circularCenter), 0);
                        }
                    }
                    if (color2 != Color.Empty && num4 > 0 && chartDashStyle != 0 && num3 < item.Points.Count)
                    {
                        if (common.ProcessModePaint)
                        {
                            graph.StartHotRegion(point2);
                            graph.StartAnimation();
                            graph.DrawLineAbs(color2, num4, chartDashStyle, pointsPosition[num], pointsPosition[num3], item.ShadowColor, (color == Color.Transparent || color == Color.Empty) ? item.ShadowOffset : 0);
                            graph.StopAnimation();
                            graph.EndHotRegion();
                        }
                        if (common.ProcessModeRegions)
                        {
                            AddSelectionPath(area, graphicsPath2, pointsPosition, num, num3, PointF.Empty, num4);
                        }
                    }
                    if (common.ProcessModeRegions)
                    {
                        int insertIndex2 = common.HotRegionsList.FindInsertIndex();
                        common.HotRegionsList.AddHotRegion(insertIndex2, graphicsPath2, relativePath: false, graph, point2, item.Name, num);
                    }
                    num++;
                }
                int num5 = 0;
                num = 0;
                foreach (DataPoint point3 in item.Points)
                {
                    Color             markerColor   = point3.MarkerColor;
                    MarkerStyle       markerStyle   = point3.MarkerStyle;
                    RadarDrawingStyle drawingStyle3 = GetDrawingStyle(item, point3);
                    if (axis.GetLogValue(point3.YValues[0]) > viewMaximum || axis.GetLogValue(point3.YValues[0]) < viewMinimum)
                    {
                        num++;
                        continue;
                    }
                    if (drawingStyle3 == RadarDrawingStyle.Marker && markerColor.IsEmpty)
                    {
                        markerColor = point3.Color;
                    }
                    SizeF markerSize = GetMarkerSize(graph, common, area, point3, point3.MarkerSize, point3.MarkerImage);
                    if (common.ProcessModePaint)
                    {
                        if (markerStyle != 0 || point3.MarkerImage.Length > 0)
                        {
                            if (markerColor.IsEmpty)
                            {
                                markerColor = point3.Color;
                            }
                            if (num5 == 0)
                            {
                                graph.StartHotRegion(point3);
                                graph.StartAnimation();
                                graph.DrawMarkerAbs(pointsPosition[num], markerStyle, (int)markerSize.Height, markerColor, point3.MarkerBorderColor, point3.MarkerBorderWidth, point3.MarkerImage, point3.MarkerImageTransparentColor, (point3.series != null) ? point3.series.ShadowOffset : 0, (point3.series != null) ? point3.series.ShadowColor : Color.Empty, new RectangleF(pointsPosition[num].X, pointsPosition[num].Y, markerSize.Width, markerSize.Height), forceAntiAlias: false);
                                graph.StopAnimation();
                                graph.EndHotRegion();
                            }
                            num5++;
                            if (item.MarkerStep == num5)
                            {
                                num5 = 0;
                            }
                        }
                        graph.StartAnimation();
                        DrawLabels(area, graph, common, pointsPosition[num], (int)markerSize.Height, point3, item, num);
                        graph.StopAnimation();
                    }
                    if (common.ProcessModeRegions)
                    {
                        SizeF  relativeSize  = graph.GetRelativeSize(markerSize);
                        PointF relativePoint = graph.GetRelativePoint(pointsPosition[num]);
                        int    insertIndex3  = common.HotRegionsList.FindInsertIndex();
                        if (point3.MarkerStyle == MarkerStyle.Circle)
                        {
                            float[] array = new float[3]
                            {
                                relativePoint.X,
                                relativePoint.Y,
                                relativeSize.Width / 2f
                            };
                            common.HotRegionsList.AddHotRegion(insertIndex3, graph, array[0], array[1], array[2], point3, item.Name, num);
                        }
                        else
                        {
                            common.HotRegionsList.AddHotRegion(insertIndex3, graph, new RectangleF(relativePoint.X - relativeSize.Width / 2f, relativePoint.Y - relativeSize.Height / 2f, relativeSize.Width, relativeSize.Height), point3, item.Name, num);
                        }
                    }
                    num++;
                }
                if (!selection)
                {
                    common.EventsManager.OnPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition));
                }
            }
        }