We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Axis Colour

When I create a SfChart the default colour of the axis lines is white, and they must be displayed on a dark background. Is there anyway to change the color of the axis lines to black?  

1 Reply

DS Durgadevi Selvaraj Syncfusion Team September 28, 2017 01:08 PM UTC

Hi Mick, 
 
Thanks for contacting Syncfusion Support. 
 
We have analyzed your requirement (changing the color of the axis lines to black) and can achieve it by setting AxisLineStyle to the Axis as shown in the below code, 
 
MainWindow.xaml: 
<Grid.Resources> 
       <Style x:Key="axisLineStyle" TargetType="Line"> 
           <Setter Property="Stroke" Value="Black"/> 
           <Setter Property="StrokeThickness" Value="3"/> 
       </Style> 
  </Grid.Resources> 
        <syncfusion:SfChart Margin="10"  > 
            <syncfusion:SfChart.PrimaryAxis> 
                <syncfusion:CategoryAxis  AxisLineStyle="{StaticResource axisLineStyle}" /> 
 
            </syncfusion:SfChart.PrimaryAxis> 
            <syncfusion:SfChart.SecondaryAxis> 
                <syncfusion:NumericalAxis AxisLineStyle="{StaticResource axisLineStyle}" /> 
            </syncfusion:SfChart.SecondaryAxis> 
           
            <syncfusion:LineSeries  ItemsSource="{Binding Collection}"   XBindingPath="XValue" YBindingPath="YValue"/> 
        </syncfusion:SfChart> 
  
We have prepared a sample based your requirement and it can be downloaded from the below link, 
 
Regards,  
Durgadevi S 
 


Loader.
Up arrow icon