I want to write the X axis vertically, as shown in the following image.
How should I do it?
- Kenichi Kobayashi asked 5 years ago
- last edited 5 years ago
- You must login to post comments
Hi there,
It is possible to rotate the XAxis labels in SciChart using this technique:
Axis Styling – Templating Axis Labels Documentation
Axis labels can be rotated if you style them via the AxisCore.TickLabelStyle property.
<Grid>
<Grid.Resources>
<Style x:Key="RotatedTickLabelStyle" TargetType="s:DefaultTickLabel">
<Setter Property="Foreground" Value="Orange"></Setter>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
<!-- Optionally override ControlTemplate for the label -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="labelProviders:DefaultTickLabel">
<ContentControl Content="{Binding}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{TemplateBinding Foreground}" IsTabStop="False" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<!-- Create the chart surface -->
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/scichart" -->
<s:SciChartSurface>
<!-- Create XAxis -->
<s:SciChartSurface.XAxis>
<s:NumericAxis AxisTitle="Styled XAxis" TextFormatting="0.000" TickLabelStyle="{StaticResource RotatedTickLabelStyle}"/>
</s:SciChartSurface.XAxis>
<!-- Create YAxis -->
<s:SciChartSurface.YAxes>
<s:NumericAxis AxisTitle="Primary YAxis" AxisAlignment="Left"/>
<s:NumericAxis Id="SecondaryYAxisId" AxisTitle="Secondary YAxis" AxisAlignment="Right" />
</s:SciChartSurface.YAxes>
</s:SciChartSurface>
</Grid>
This will result in rotated axis labels.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 5 years ago
-
Thank you very much. I am grateful.
- You must login to post comments
Please login first to submit.