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?
- Tomas Pettersson asked 10 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Thank you! That did the trick.
- Tomas Pettersson answered 10 years ago
- You must login to post comments
Please login first to submit.