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


I want to align my left YAaxis labels to right and fixed label width. I use Spectrogram view and want to align the left edges of those charts. (I’m using version 4.0.2)

This is my style definition:

 <Style x:Key="LeftAxisLabelStyle" TargetType="s:DefaultTickLabel">
    <Setter Property="HorizontalAnchorPoint" Value="Right"/>
    <Setter Property="Width" Value="20"/>

but unfortunately it doesn’t work.

  • You must to post comments
Best Answer

Hi Andrew,

Unfortunately your solution does not solve my problem. But I have found my own one. Here you are:

<Style x:Key="LeftAxisLabelStyle" TargetType="s:DefaultTickLabel">
    <Setter Property="ContentTemplate">
                    <TextBlock Width="40" TextAlignment="Right" Text="{Binding Text}"/>

Best regards,

  • Andrew Burnett-Thompson
    Hi Marek, thank you for sharing that answer, it will surely help other people too! Best regards, Andrew
  • You must to post comments

Hi Marek,

Thank you for your question! The default axis layout doesn’t allow to right-align its internals. But, it is possible to right-align the entire axis instead.

You can achieve the desired result providing a panel with a desired Width as LeftAxesPanelTemplate and setting HorizontalAlignment on the axis:

     <ItemsPanelTemplate x:Key="LeftAxesPanel">
         <!-- Set the desired width on the panel -->
         <Grid Width="100"/>

     <!-- Use the panel as a container for left-aligned axes -->
     <s:SciChartSurface LeftAxesPanelTemplate="{StaticResource LeftAxesPanel}">

            <s:NumericAxis Id="LeftAxis" AxisAlignment="Left"  />


Please let me know if this helps.

Best regards,

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.