Pre loader

Tick label rotation using data bound vertical axes

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I’m using the YAxes property of the chart to data bind to a collection of NumericAxisViewModels. Is there a way to rotate the tick labels in this scenario. I can’t define a style in XAML and then assign it to the Axis because the axis is created in scichart somewhere. All I have is the axis view model. I have a LabelProvider but it doesn’t seem to support rotation unless I access the ParentAxis. Ultimately I would like to rotate some vertical axis and not other but I might be able to live with rotating all of them.

I have tried defining a style in xaml that applies to all numeric axis but it didn’t work:

<Style TargetType="{x:Type s:DefaultTickLabel}">
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <RotateTransform Angle="-90"/>
            </Setter.Value>
        </Setter>
    </Style>

Adding a LabelProvider sort of works but seems a little hacky and doesn’t set the scale appropriately ( I have to zoom to extends to see the labels). Is this the way I am supposed to do it?

public override string FormatLabel(IComparable dataValue) {
        var style = new Style(typeof(DefaultTickLabel));
        style.Setters.Add(new Setter(DefaultTickLabel.LayoutTransformProperty, new  RotateTransform(-90.0)));
        ParentAxis.TickLabelStyle = style;
Version
5.1
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.