我想更改Oxyplot LineAnnotation中的文本位置

问题描述 投票:2回答:1

这段代码就是一个例子

var lineAnnotation4 = new LineAnnotation();
        lineAnnotation4.Type = LineAnnotationType.Horizontal;
        lineAnnotation4.Y = 2;
        lineAnnotation4.Color = OxyColors.Gold;
        lineAnnotation4.MaximumX = 4;
        lineAnnotation4.Text = "Horizontal";
        plotModel1.Annotations.Add(lineAnnotation4);

我在想什么。文本位置始终低于该行。像这样..

有没有办法将文字放在线上?像这样.. enter image description here

谢谢。

oxyplot
1个回答
1
投票

试试lineAnnotation4.TextVerticalAlignment = VerticalAlignment.Top

编辑:似乎反直觉,但你实际上需要指定lineAnnotation4.TextVerticalAlignment = VerticalAlignment.Bottom;

© www.soinside.com 2019 - 2024. All rights reserved.