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

0
0

Hi,
I’m wondering, if there any chance to hide or change the font size of XAxis label numbers.
Thanks

  • You must to post comments
0
0

Hello,

Yes, there is – you can set XAxis.DrawLabels=false to hide the X-labels. Also all elements are stylable via XAML, we have a Silverlight demonstration app that shows you how to do this.

An example of a XAML style is here:

 <!-- Define styles for the X and Y Axes -->
        <Style x:Key="AxisStyle" TargetType="sciChart:AxisBase">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="TitleFontSize" Value="12"/>
            <Setter Property="TitleFontWeight" Value="Bold"/>
            <Setter Property="TickTextBrush" Value="Crimson"/>
            <Setter Property="MajorTickLineStyle">
                <Setter.Value>
                    <Style TargetType="Line">
                        <Setter Property="Stroke" Value="GreenYellow"/>
                        <Setter Property="StrokeThickness" Value="2"/>
                        <Setter Property="X2" Value="8"/>
                        <Setter Property="Y2" Value="8"/>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="MinorTickLineStyle">
                <Setter.Value>
                    <Style TargetType="Line">
                        <Setter Property="Stroke" Value="Violet"/>
                        <Setter Property="StrokeThickness" Value="1"/>
                        <Setter Property="X2" Value="4"/>
                        <Setter Property="Y2" Value="4"/>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="MajorGridLineStyle">
                <Setter.Value>
                    <Style TargetType="Line">
                        <Setter Property="Stroke" Value="GreenYellow"/>
                        <Setter Property="StrokeThickness" Value="2"/>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="MinorGridLineStyle">
                <Setter.Value>
                    <Style TargetType="Line">
                        <Setter Property="Stroke" Value="Violet"/>
                        <Setter Property="StrokeThickness" Value="1"/>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>

Best regards,
Andrew

  • Amir
    Thanks Andrew It works.
  • rcannon
    In SciChart's newest version, is there a way to programmatically hide the x axis labels on a datetime axis?
  • Andrew
    Hi there, yes there is, from the post above:
    you can set XAxis.DrawLabels=false to hide the X-labels
  • rcannon
    I ask because I can't seem to access it through Surface.XAxis.DrawLabels or Surface.XAxes[i].DrawLabels though I can access the other four draw settings through both of those methods. The only method to access it seems to be by naming the x-axis in question and then calling it by name.
  • Andrew
    Ah got it, try casting the SciChartSurface.XAxis to AxisBase. I didn't realise the DrawLabels property was not on the interface.
  • rcannon
    Works perfectly once I figured out how to do that.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.