Exemple #1
0
        public void PaintCustom(ChartGraphics graph)
        {
            CommonElements common     = this.axis.Common;
            PointF         empty      = PointF.Empty;
            PointF         empty2     = PointF.Empty;
            RectangleF     rectangleF = this.axis.PlotAreaPosition.ToRectangleF();

            foreach (CustomLabel customLabel in this.axis.CustomLabels)
            {
                if ((customLabel.GridTicks & GridTicks.Gridline) == GridTicks.Gridline)
                {
                    double num = (customLabel.To + customLabel.From) / 2.0;
                    if (num >= this.axis.GetViewMinimum() && num <= this.axis.GetViewMaximum())
                    {
                        if (this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right)
                        {
                            empty.X  = rectangleF.X;
                            empty2.X = rectangleF.Right;
                            empty.Y  = (float)this.axis.GetLinearPosition(num);
                            empty2.Y = empty.Y;
                        }
                        if (this.axis.AxisPosition == AxisPosition.Top || this.axis.AxisPosition == AxisPosition.Bottom)
                        {
                            empty.Y  = rectangleF.Y;
                            empty2.Y = rectangleF.Bottom;
                            empty.X  = (float)this.axis.GetLinearPosition(num);
                            empty2.X = empty.X;
                        }
                        if (common.ProcessModeRegions)
                        {
                            if (!this.axis.chartArea.Area3DStyle.Enable3D || this.axis.chartArea.chartAreaIsCurcular)
                            {
                                GraphicsPath graphicsPath = new GraphicsPath();
                                if (Math.Abs(empty.X - empty2.X) > Math.Abs(empty.Y - empty2.Y))
                                {
                                    graphicsPath.AddLine(empty.X, (float)(empty.Y - 1.0), empty2.X, (float)(empty2.Y - 1.0));
                                    graphicsPath.AddLine(empty2.X, (float)(empty2.Y + 1.0), empty.X, (float)(empty.Y + 1.0));
                                    graphicsPath.CloseAllFigures();
                                }
                                else
                                {
                                    graphicsPath.AddLine((float)(empty.X - 1.0), empty.Y, (float)(empty2.X - 1.0), empty2.Y);
                                    graphicsPath.AddLine((float)(empty2.X + 1.0), empty2.Y, (float)(empty.X + 1.0), empty.Y);
                                    graphicsPath.CloseAllFigures();
                                }
                                common.HotRegionsList.AddHotRegion(graphicsPath, true, graph, ChartElementType.Gridlines, this);
                            }
                            else
                            {
                                graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, common, this);
                            }
                        }
                        if (common.ProcessModePaint)
                        {
                            if (!this.axis.chartArea.Area3DStyle.Enable3D || this.axis.chartArea.chartAreaIsCurcular)
                            {
                                graph.DrawLineRel(this.borderColor, this.borderWidth, this.borderStyle, empty, empty2);
                            }
                            else
                            {
                                graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, this.axis.Common, this);
                            }
                        }
                    }
                }
            }
        }
 public void Paint(ChartGraphics graph, CommonElements common, bool drawLinesOnly)
 {
     if (!this.axis.chartArea.chartAreaIsCurcular)
     {
         RectangleF rect = this.axis.chartArea.PlotAreaPosition.ToRectangleF();
         bool       flag = true;
         if (this.axis.AxisPosition == AxisPosition.Bottom || this.axis.AxisPosition == AxisPosition.Top)
         {
             flag = false;
         }
         Series series = null;
         if (this.axis.axisType == AxisName.X || this.axis.axisType == AxisName.X2)
         {
             ArrayList xAxesSeries = this.axis.chartArea.GetXAxesSeries((AxisType)((this.axis.axisType != 0) ? 1 : 0), this.axis.SubAxisName);
             if (xAxesSeries.Count > 0)
             {
                 series = this.axis.Common.DataManager.Series[xAxesSeries[0]];
                 if (series != null && !series.XValueIndexed)
                 {
                     series = null;
                 }
             }
         }
         double num = this.axis.GetViewMinimum();
         if (!this.axis.chartArea.chartAreaIsCurcular || this.axis.axisType == AxisName.Y || this.axis.axisType == AxisName.Y2)
         {
             double num2 = this.Interval;
             if (this.interlaced)
             {
                 num2 /= 2.0;
             }
             num = this.axis.AlignIntervalStart(num, num2, this.IntervalType, series);
         }
         if (this.Interval != 0.0 && (this.axis.GetViewMaximum() - this.axis.GetViewMinimum()) / this.axis.GetIntervalSize(num, this.interval, this.intervalType, series, 0.0, DateTimeIntervalType.Number, false) > 10000.0)
         {
             return;
         }
         DateTimeIntervalType type = (this.IntervalOffsetType == DateTimeIntervalType.Auto) ? this.IntervalType : this.IntervalOffsetType;
         if (this.Interval == 0.0)
         {
             num = this.IntervalOffset;
         }
         else if (this.IntervalOffset > 0.0)
         {
             num += this.axis.GetIntervalSize(num, this.IntervalOffset, type, series, 0.0, DateTimeIntervalType.Number, false);
         }
         else if (this.IntervalOffset < 0.0)
         {
             num -= this.axis.GetIntervalSize(num, 0.0 - this.IntervalOffset, type, series, 0.0, DateTimeIntervalType.Number, false);
         }
         int num3 = 0;
         while (num3++ <= 10000)
         {
             if (this.StripWidth > 0.0 && !drawLinesOnly)
             {
                 double num5 = num + this.axis.GetIntervalSize(num, this.StripWidth, this.StripWidthType, series, this.IntervalOffset, type, false);
                 if (num5 > this.axis.GetViewMinimum() && num < this.axis.GetViewMaximum())
                 {
                     RectangleF empty = RectangleF.Empty;
                     double     val   = (double)(float)this.axis.GetLinearPosition(num);
                     double     val2  = (double)(float)this.axis.GetLinearPosition(num5);
                     if (flag)
                     {
                         empty.X      = rect.X;
                         empty.Width  = rect.Width;
                         empty.Y      = (float)Math.Min(val, val2);
                         empty.Height = (float)Math.Max(val, val2) - empty.Y;
                         empty.Intersect(rect);
                     }
                     else
                     {
                         empty.Y      = rect.Y;
                         empty.Height = rect.Height;
                         empty.X      = (float)Math.Min(val, val2);
                         empty.Width  = (float)Math.Max(val, val2) - empty.X;
                         empty.Intersect(rect);
                     }
                     if (empty.Width > 0.0 && empty.Height > 0.0)
                     {
                         graph.StartHotRegion(this.href, this.toolTip);
                         if (!this.axis.chartArea.Area3DStyle.Enable3D)
                         {
                             graph.StartAnimation();
                             graph.FillRectangleRel(empty, this.BackColor, this.BackHatchStyle, this.BackImage, this.BackImageMode, this.BackImageTransparentColor, this.BackImageAlign, this.BackGradientType, this.BackGradientEndColor, this.BorderColor, this.BorderWidth, this.BorderStyle, Color.Empty, 0, PenAlignment.Inset);
                             graph.StopAnimation();
                         }
                         else
                         {
                             this.Draw3DStrip(graph, empty, flag);
                         }
                         graph.EndHotRegion();
                         this.PaintTitle(graph, empty);
                         if (common.ProcessModeRegions && !this.axis.chartArea.Area3DStyle.Enable3D)
                         {
                             common.HotRegionsList.AddHotRegion(graph, empty, this.ToolTip, this.Href, this.MapAreaAttributes, this, ChartElementType.StripLines, string.Empty);
                         }
                     }
                 }
             }
             else if (this.StripWidth == 0.0 && drawLinesOnly && num > this.axis.GetViewMinimum() && num < this.axis.GetViewMaximum())
             {
                 PointF empty2 = PointF.Empty;
                 PointF empty3 = PointF.Empty;
                 if (flag)
                 {
                     empty2.X = rect.X;
                     empty2.Y = (float)this.axis.GetLinearPosition(num);
                     empty3.X = rect.Right;
                     empty3.Y = empty2.Y;
                 }
                 else
                 {
                     empty2.X = (float)this.axis.GetLinearPosition(num);
                     empty2.Y = rect.Y;
                     empty3.X = empty2.X;
                     empty3.Y = rect.Bottom;
                 }
                 graph.StartHotRegion(this.href, this.toolTip);
                 if (!this.axis.chartArea.Area3DStyle.Enable3D)
                 {
                     graph.DrawLineRel(this.BorderColor, this.BorderWidth, this.BorderStyle, empty2, empty3);
                 }
                 else
                 {
                     graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty2, empty3, flag, this.axis.Common, this);
                 }
                 graph.EndHotRegion();
                 this.PaintTitle(graph, empty2, empty3);
                 if (common.ProcessModeRegions)
                 {
                     SizeF size = new SizeF((float)(this.BorderWidth + 1), (float)(this.BorderWidth + 1));
                     size = graph.GetRelativeSize(size);
                     RectangleF empty4 = RectangleF.Empty;
                     if (flag)
                     {
                         empty4.X      = empty2.X;
                         empty4.Y      = (float)(empty2.Y - size.Height / 2.0);
                         empty4.Width  = empty3.X - empty2.X;
                         empty4.Height = size.Height;
                     }
                     else
                     {
                         empty4.X      = (float)(empty2.X - size.Width / 2.0);
                         empty4.Y      = empty2.Y;
                         empty4.Width  = size.Width;
                         empty4.Height = empty3.Y - empty2.Y;
                     }
                     common.HotRegionsList.AddHotRegion(graph, empty4, this.ToolTip, this.Href, this.MapAreaAttributes, this, ChartElementType.StripLines, string.Empty);
                 }
             }
             if (this.Interval > 0.0)
             {
                 num += this.axis.GetIntervalSize(num, this.Interval, this.IntervalType, series, this.IntervalOffset, type, false);
             }
             if (!(this.Interval > 0.0))
             {
                 break;
             }
             if (!(num <= this.axis.GetViewMaximum()))
             {
                 break;
             }
         }
     }
 }
Exemple #3
0
        private void DrawGrid(ChartGraphics graph, double current, int numberOfElements, int index)
        {
            CommonElements common     = this.axis.Common;
            PointF         point      = PointF.Empty;
            PointF         empty      = PointF.Empty;
            PointF         empty2     = PointF.Empty;
            RectangleF     rectangleF = this.axis.PlotAreaPosition.ToRectangleF();

            if (this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right)
            {
                empty.X  = rectangleF.X;
                empty2.X = rectangleF.Right;
                empty.Y  = (float)this.axis.GetLinearPosition(current);
                empty2.Y = empty.Y;
                point    = empty;
            }
            if (this.axis.AxisPosition == AxisPosition.Top || this.axis.AxisPosition == AxisPosition.Bottom)
            {
                empty.Y  = rectangleF.Y;
                empty2.Y = rectangleF.Bottom;
                empty.X  = (float)this.axis.GetLinearPosition(current);
                empty2.X = empty.X;
                point    = empty2;
            }
            if (common.ProcessModeRegions)
            {
                if (this.axis.chartArea.Area3DStyle.Enable3D && !this.axis.chartArea.chartAreaIsCurcular)
                {
                    graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, common, this);
                }
                else if (!this.axis.chartArea.chartAreaIsCurcular)
                {
                    GraphicsPath graphicsPath = new GraphicsPath();
                    if (Math.Abs(empty.X - empty2.X) > Math.Abs(empty.Y - empty2.Y))
                    {
                        graphicsPath.AddLine(empty.X, (float)(empty.Y - 1.0), empty2.X, (float)(empty2.Y - 1.0));
                        graphicsPath.AddLine(empty2.X, (float)(empty2.Y + 1.0), empty.X, (float)(empty.Y + 1.0));
                        graphicsPath.CloseAllFigures();
                    }
                    else
                    {
                        graphicsPath.AddLine((float)(empty.X - 1.0), empty.Y, (float)(empty2.X - 1.0), empty2.Y);
                        graphicsPath.AddLine((float)(empty2.X + 1.0), empty2.Y, (float)(empty.X + 1.0), empty.Y);
                        graphicsPath.CloseAllFigures();
                    }
                    common.HotRegionsList.AddHotRegion(graphicsPath, true, graph, ChartElementType.Gridlines, this);
                }
            }
            if (common.ProcessModePaint)
            {
                if (this.axis.chartArea.chartAreaIsCurcular)
                {
                    this.InitAnimation(this.axis.Common, point, graph, numberOfElements, index);
                    graph.StartAnimation();
                    if (this.axis.axisType == AxisName.Y)
                    {
                        this.axis.DrawCircularLine(this, graph, this.borderColor, this.borderWidth, this.borderStyle, empty.Y);
                    }
                    if (this.axis.axisType == AxisName.X)
                    {
                        ICircularChartType circularChartType = this.axis.chartArea.GetCircularChartType();
                        if (circularChartType != null && circularChartType.RadialGridLinesSupported())
                        {
                            this.axis.DrawRadialLine(this, graph, this.borderColor, this.borderWidth, this.borderStyle, current);
                        }
                    }
                    graph.StopAnimation();
                }
                else if (!this.axis.chartArea.Area3DStyle.Enable3D || this.axis.chartArea.chartAreaIsCurcular)
                {
                    this.InitAnimation(this.axis.Common, point, graph, numberOfElements, index);
                    graph.StartAnimation();
                    graph.DrawLineRel(this.borderColor, this.borderWidth, this.borderStyle, empty, empty2);
                    graph.StopAnimation();
                }
                else
                {
                    graph.Draw3DGridLine(this.axis.chartArea, this.borderColor, this.borderWidth, this.borderStyle, empty, empty2, this.axis.AxisPosition == AxisPosition.Left || this.axis.AxisPosition == AxisPosition.Right, this.axis.Common, this, numberOfElements, index);
                }
            }
        }