Ejemplo n.º 1
0
        /// <summary>
        /// Create an annotation shape and add it to the chart area. and return annotation.
        /// </summary>
        public Annotation AddAnnotationShape(string name, string text, PointF[] points, System.Drawing.Color?borderColor, System.Drawing.Color?fillColor, float lineWidth = 2, float opacity = 1, Charting.Base.AnnotationDrawingLayer drawingLayer = Charting.Base.AnnotationDrawingLayer.FrontOfSeriesAndAxisAndGrid, Charting.Base.FillPattern fillPattern = Charting.Base.FillPattern.Solid, float patternSize = 8, Axis Vertical_axis = null, Axis Horizontal_axis = null)
        {
            AnnotationPolygon annot;

            annot = new AnnotationPolygon(this, points);
            annotations.Add(annot);
            annot.opacity      = opacity;
            annot.lineWidth    = lineWidth;
            annot.fillColor    = fillColor;
            annot.color        = borderColor;
            annot.DrawingLayer = drawingLayer;
            annot.fillPattern  = fillPattern;
            annot.patternSize  = patternSize;
            annot.Initialize(device);
            annot.horizontalAxis = Horizontal_axis;
            annot.verticalAxis   = Vertical_axis;
            ReDrawLayer(drawingLayer);
            annot.Name = name;
            annot.Text = text;
            return(annot);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create an annotation shape and add it to the chart area. and return annotation.
        /// </summary>
        public Annotation AddAnnotationShape(string name, string text, PointF topLeftPoint, PointF bottomRight, bool isRectangleAnnotation, System.Drawing.Color?borderColor, System.Drawing.Color?fillColor, float lineWidth = 2, float opacity = 1, Charting.Base.AnnotationDrawingLayer drawingLayer = Charting.Base.AnnotationDrawingLayer.FrontOfSeriesAndAxisAndGrid, Charting.Base.FillPattern fillPattern = Charting.Base.FillPattern.Solid, float patternSize = 8, Axis Vertical_axis = null, Axis Horizontal_axis = null)
        {
            AnnotationShape annot;

            if (isRectangleAnnotation)
            {
                annot = new AnnotationRectangle(this);
            }
            else
            {
                annot = new AnnotationEllipse(this);
            }
            annotations.Add(annot);
            annot.startValuePoint = topLeftPoint;
            annot.endValuePoint   = bottomRight;
            annot.opacity         = opacity;
            annot.lineWidth       = lineWidth;
            annot.fillColor       = fillColor;
            annot.color           = borderColor;
            annot.DrawingLayer    = drawingLayer;
            annot.fillPattern     = fillPattern;
            annot.patternSize     = patternSize;
            annot.Initialize(device);
            annot.horizontalAxis = Horizontal_axis;
            annot.verticalAxis   = Vertical_axis;
            ReDrawLayer(drawingLayer);
            annot.Name = name;
            annot.Text = text;
            return(annot);
        }