【问题标题】:Oxyplot - LineAnnotion text display horizontallyOxyplot - LineAnnotion 文本水平显示
【发布时间】:2019-12-16 22:57:02
【问题描述】:

我使用 C# 和 Oxyplot。

我有一个 LineAnnotation 我想添加一个文本。

所以我为 LineAnnotation 设置了 Text 属性,但是文本是垂直对齐的。

如何将文本(1..3 行)添加到 LineAnnotation 并且文本水平显示,以便用户阅读?

不好:

我想要什么:

LineAnnotation Markerline = new LineAnnotation();

Markerline.Color           = OxyColors.Blue;
Markerline.LineStyle       = LineStyle.Solid;
Markerline.StrokeThickness = 5;
Markerline.Type            = LineAnnotationType.Vertical;
Markerline.XAxisKey        = "x1";
Markerline.YAxisKey        = yAxisKey;  
Markerline.Tag             = "Marker";

Markerline.Text = "Hello World";  //how to display on top of Markerline horizontally ?

【问题讨论】:

    标签: oxyplot


    【解决方案1】:

    只需设置 LineAnnotationType:

    Markerline.Type            = LineAnnotationType.Horizontal;
    

    【讨论】:

      【解决方案2】:

      你需要 LineAnnotation.TextOrientation 属性。例如,

      Markerline.TextOrientation = AnnotationTextOrientation.Horizontal;
      

      此外,您还可以设置 LineAnnotation.TextHorizo​​ntalAlingment 属性来指示 Text 相对于 Line Annotation 的位置。

      Markerline.TextHorizontalAlignment = HorizontalAlignment.Left;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-18
        • 1970-01-01
        • 2015-06-10
        • 1970-01-01
        相关资源
        最近更新 更多