Esempio n. 1
0
        /// <summary>
        /// Draw axis label on the graphics.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="parentControl"></param>
        /// <param name="axesType"></param>
        /// <param name="isDrawString"></param>
        public void Draw(Graphics g, Point pos, ChartArea parentControl, AxisDirection axesType, bool isDrawString = true)
        {
            try
            {
                if (axesType == AxisDirection.Vertical)
                {
                    if (IsAxisTitle)
                    {
                        if (axis.series.Count == 0)
                        {
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], textRectangle, xPFT.Charting.Base.FontDrawFlags.Left, axis.TitleColor, 1, (float)System.Math.PI / 2, Font);
                        }
                        else
                        {
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], new Rectangle(textRectangle.X, textRectangle.Y + 15, textRectangle.Width, textRectangle.Height),
                                                                  xPFT.Charting.Base.FontDrawFlags.Left, axis.TitleColor, 1, (float)System.Math.PI / 2, axis.Font);
                            points[0]  = new PointF(textRectangle.X - textRectangle.Height / 2, textRectangle.Location.Y);
                            points[1]  = new PointF(textRectangle.X - textRectangle.Height / 2, textRectangle.Location.Y + 10);
                            line.Width = axis.series[0].LineThickness;

                            if (axis.series[0].ChartType == SeriesChartType.Line)
                            {
                                xPFT.GraphicEngineGDI.Line.Draw(g, pos, points, axis.series[0].LineColor, 1, axis.series[0].LineThickness, axis.series[0].LinePattern);
                            }
                            else
                            {
                                switch (axis.series[0].ChartType)
                                {
                                case SeriesChartType.Point_Ellipse:
                                    xPFT.GraphicEngineGDI.Line.DrawPoints(g, pos, points, axis.series[0].LineColor, 1, 0, axis.series[0].LineThickness);
                                    break;

                                case SeriesChartType.Point_Rectangle:
                                    xPFT.GraphicEngineGDI.Line.DrawPoints(g, pos, points, axis.series[0].LineColor, 1, 1, axis.series[0].LineThickness);
                                    break;

                                case SeriesChartType.Point_Star:
                                    xPFT.GraphicEngineGDI.Line.DrawPoints(g, pos, points, axis.series[0].LineColor, 1, 2, axis.series[0].LineThickness);
                                    break;

                                case SeriesChartType.Point_X:
                                    xPFT.GraphicEngineGDI.Line.DrawPoints(g, pos, points, axis.series[0].LineColor, 1, 3, axis.series[0].LineThickness);
                                    break;

                                case SeriesChartType.Point_Diamond:
                                    xPFT.GraphicEngineGDI.Line.DrawPoints(g, pos, points, axis.series[0].LineColor, 1, 4, axis.series[0].LineThickness);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        xPFT.GraphicEngineGDI.Line.Draw(g, pos, points, color);
                        if (axis.LabelInTrueSide)
                        {
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], textRectangle, xPFT.Charting.Base.FontDrawFlags.Right, color, 1, 0, axis.Font);
                        }
                        else
                        {
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], textRectangle, xPFT.Charting.Base.FontDrawFlags.Left, color, 1, 0, axis.Font);
                        }
                    }
                }
                else
                {
                    if (IsAxisTitle)
                    {
                        xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], textRectangle, xPFT.Charting.Base.FontDrawFlags.Right, axis.TitleColor, 1, 0, Font);
                    }
                    else
                    {
                        xPFT.GraphicEngineGDI.Line.Draw(g, pos, points, color);
                        if (isDrawString)
                        {
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[0], textRectangle, xPFT.Charting.Base.FontDrawFlags.Center, color, 1, 0, axis.Font);
                            xPFT.GraphicEngineGDI.TextWriter.Draw(g, pos, Text[1], new Rectangle(textRectangle.X, textRectangle.Y + (int)(Font.Height * 0.8), textRectangle.Width, textRectangle.Height), xPFT.Charting.Base.FontDrawFlags.Center, color, 1, 0, axis.Font);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                xPFT.Exceptions.ExceptionHandler.LogError(ex);
            }
        }
 public AnnotationEllipse(ChartArea chA)
 {
     CreateAnnotationShape(chA);
 }