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
1
0

From reading the material on the site I know how to do what I want to do in xaml:

    <Style x:Key="AxisLabelStyle" TargetType="s:DefaultTickLabel">
    <Setter Property="RenderTransform">
        <Setter.Value>
            <RotateTransform Angle="30"/>
        </Setter.Value>
    </Setter>
    <Setter Property="HorizontalAnchorPoint" Value="Left"/>
</Style>

Now however my chart will be using two diffrent x-axis, one numeric and one with date and time. Both axis are defined in code:

            _xAxisNum = new NumericAxis
        {
            ...
        };

        _xAxisDat = new DateTimeAxis
        {
            ...
        };

        InitializeComponent();
        sciChartSurface.XAxis = _xAxisDat;

What code must I add to my x-axes to get the same result as the xaml above accomplishes? Or can I achieve what I want with a LabelProvider?

  • You must to post comments
Best Answer
1
0

Hi Tomas,

While we recommend you create your styles in XAML and follow the MVVM pattern where possible, you can still do this in code-behind.

Please take a look at this stackoverflow post on How to create a style in Code Behind.

Also this post Implicit styles in Application.Resources shows an alternative way to apply styles globally to all classes of a specific type.

Finally, I would recommend that you use LayoutTransform, not RenderTransform, as this will affect the layout of the axis labels and prevent them from being sized incorrectly.

Best regards,
Andrew

  • You must to post comments
1
0

Thank you! That did the trick.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.