SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
0
0

I have got a CustomTextAnnotation like in this example CustomTextAnnotation
I added a Rendertransform like this.

<s:TextAnnotation.RenderTransform>
    <RotateTransform Angle="90"/>
</s:TextAnnotation.RenderTransform>

But the AnchorPoint is not used as rotation center.
I thought of using ToCoordinate() but need a calculator for that which is not available within CustomTextAnnotation.

What is best practice to achive the requested rotation in sciChart?

Images
  • You must to post comments
Best Answer
0
0

I don’t know how to do this in XAML but in the codebehind you can use this

        RotateTransform tns = new RotateTransform();

        tns.Angle = 90;
        verticalText.RenderTransformOrigin = new Point(0.5f, 0.5f);
        verticalText.RenderTransform = tns;

RenderTransformOrigin is the center of the rotation being applied.

  • Bürger Martin
    That did the trick,View (XAML):<s:TextAnnotation RenderTransformOrigin="{Binding RenderOrigin}" ...ViewModel: public Point RenderOrigin { get { var p = new Point(); switch (HorizontalAnchor) { case HorizontalAnchorPoint.Left: p.X = 0; break; case HorizontalAnchorPoint.Center: p.X = 0.5; break; case HorizontalAnchorPoint.Right: p.X = 1; break; } switch (VerticalAnchor) { case VerticalAnchorPoint.Bottom: p.Y = 1; break; case VerticalAnchorPoint.Center: p.Y = 0.5; break; case VerticalAnchorPoint.Top: p.Y = 0; break; } return p; } set { ;} }
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.