yong
yong

Reputation: 61

I want to change the Text position in Oxyplot LineAnnotation

this code is in example

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);

What I was wondering. The Text position is always below the line. like this..

Is there a way to position text above the line? like this.. enter image description here

thanks.

Upvotes: 2

Views: 2233

Answers (1)

harveyAJ
harveyAJ

Reputation: 917

Try lineAnnotation4.TextVerticalAlignment = VerticalAlignment.Top

Edit: Seems rather counter intuitive, but you actually need to specify lineAnnotation4.TextVerticalAlignment = VerticalAlignment.Bottom;

Upvotes: 1

Related Questions