使自定义SciChart注释可在图形上移动

时间:2019-04-30 11:00:11

标签: scichart

我正在尝试为图形制作可移动的自定义注释。将鼠标悬停在其上方时,会出现“箭头十字”用于移动注释,但实际上无法移动注释。 那就是我的代码的样子:

public partial class Calibration : CustomAnnotation
    {
        public Calibration()
        {
            InitializeComponent();
            this.IsResizable = false;
            this.DragDirections = SciChart.Charting.XyDirection.XYDirection;
            this.IsEditable = true;
            this.HorizontalAnchorPoint = HorizontalAnchorPoint.Left;
            this.VerticalAnchorPoint = VerticalAnchorPoint.Bottom;
            this.CoordinateMode = AnnotationCoordinateMode.Relative;

            this.X1 = 0.1;
            this.Y1 = 0.9;
        }
    }

作为最终结果,我想要的是自定义注释,该注释最初显示在左下角(有效),并且可以使用鼠标移动。以便用户可以将其放置在图形上的任何位置。 有什么建议可以使注释可移动吗?

1 个答案:

答案 0 :(得分:0)

要使CustomAnnotation在SciChart WPF中可编辑,只需设置Annotation.IsEditable = true

它应该“正常工作”

在SciChart网站上查看名为“ Create Annotations Dynamically”的示例。

enter image description here

在此示例中,单击左侧的注释图标,选择“ MyCustomAnnotation”,然后单击“添加注释”。这会将CustomAnnotation添加到图表,您应该可以单击,编辑和移动它。

最后,以上示例的源代码为here