예제 #1
0
        /// <summary>
        /// 创建PointAnnotation图像
        /// </summary>
        /// <param name="markText">标注文字</param>
        /// <param name="centerX">标注的中心坐标</param>
        /// <param name="centerY">标注的中心坐标</param>
        /// <param name="markerSize">标注的大小</param>
        /// <param name="borderColor">边框颜色</param>
        /// <param name="fillColor">填充颜色</param>
        /// <param name="lineWidth">线宽</param>
        /// <param name="markerType">标记形状</param>
        /// <returns></returns>
        public static PointAnnotation CreatePointAnnotation(string markText, double centerX, double centerY, double markerSize = 5.0, SolidColorBrush borderColor = null, SolidColorBrush fillColor = null, double lineWidth = 1.0, MarkerType markerType = MarkerType.Circle)
        {
            if (borderColor == null)
            {
                borderColor = Brushes.Black;
            }
            if (fillColor == null)
            {
                fillColor = Brushes.Transparent;
            }

            PointAnnotation annotation = new PointAnnotation()
            {
                X               = centerX,
                Y               = centerY,
                Size            = markerSize,
                Stroke          = ChartCommonMethod.ToOxyColor(borderColor),
                StrokeThickness = lineWidth,
                Fill            = ChartCommonMethod.ToOxyColor(fillColor),
                Text            = markText,
                Shape           = markerType,
            };

            return(annotation);
        }
예제 #2
0
 /// <summary>
 /// 获取图形线条颜色
 /// </summary>
 /// <param name="color">线条颜色</param>
 /// <returns></returns>
 private void SetBorderColor(SolidColorBrush color)
 {
     if (AnnChart is ShapeAnnotation shapeAnn)
     {
         shapeAnn.Stroke = ChartCommonMethod.ToOxyColor(color);
     }
 }
예제 #3
0
 /// <summary>
 /// 获取图形填充颜色
 /// </summary>
 /// <param name="color">线条颜色</param>
 /// <returns></returns>
 private void SetFillColor(SolidColorBrush color)
 {
     if (AnnChart is ShapeAnnotation shapeAnn)
     {
         shapeAnn.Fill = ChartCommonMethod.ToOxyColor(color);
     }
 }
예제 #4
0
        /// <summary>
        /// 创建RectangleAnnotation图像,NaN表示值由显示的高度或宽度决定
        /// </summary>
        /// <param name="markText">标注文字</param>
        /// <param name="minX">起始X</param>
        /// <param name="minY">起始Y</param>
        /// <param name="maxX">结束X</param>
        /// <param name="maxY">结束Y</param>
        /// <param name="markerSize">标注的大小</param>
        /// <param name="borderColor">边框颜色</param>
        /// <param name="fillColor">填充颜色</param>
        /// <param name="lineWidth">线宽</param>
        /// <returns></returns>
        public static RectangleAnnotation CreateRectangleAnnotation(string markText, double minX = double.NaN, double maxX = double.NaN, double minY = double.NaN, double maxY = double.NaN, double markerSize = 5.0, SolidColorBrush borderColor = null, SolidColorBrush fillColor = null, double lineWidth = 1.0)
        {
            if (borderColor == null)
            {
                borderColor = Brushes.Black;
            }
            if (fillColor == null)
            {
                fillColor = Brushes.Transparent;
            }

            RectangleAnnotation annotation = new RectangleAnnotation()
            {
                MinimumX        = minX,
                MaximumX        = maxX,
                MinimumY        = minY,
                MaximumY        = maxY,
                Stroke          = ChartCommonMethod.ToOxyColor(borderColor),
                StrokeThickness = lineWidth,
                Fill            = ChartCommonMethod.ToOxyColor(fillColor),
                Text            = markText
            };

            return(annotation);
        }