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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hide Axis Labels

Thread ID:

Created:

Updated:

Platform:

Replies:

117975 Jan 15,2015 01:43 PM UTC Nov 8,2018 11:42 AM UTC Xamarin.Forms 9
loading
Tags: SfChart
Markus Demmler
Asked On January 15, 2015 01:43 PM UTC

I can set MaximumLabels="but a label for lowest and highest value is still shown.
How can I hide all labels of an axis?

Magesh Kumar Krishnan [Syncfusion]
Replied On January 15, 2015 06:49 PM UTC

Hi Markus,

Thanks for using Syncfusion products.

We have analysed your requirement and we can hide the chart axis labels by using label font size as in below code snippet.

Code snippet:

[C#]
Axis.LabelStyle.Font = Font.SystemFontOfSize(0.01d);

[XAML]
<chart:NumericalAxis>
   <chart:NumericalAxis.LabelStyle>
       <chart:ChartAxisLabelStyle Font="0.01"/>
   </chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>

Please let us know if you need any further assistance on this.

Thanks,
Magesh Kumar K


Markus Demmler
Replied On January 16, 2015 06:49 AM UTC

It works. Thanks.
Is it also possible to not just hide the labels but also the whole line and the label ticks?

Rajasekar B [Syncfusion]
Replied On January 16, 2015 07:12 AM UTC

Hi Markus,

You can collapse entire axis including ticks, title and labels by setting IsVisible property of axis to false.

For example,

[c#]
Axis.IsVisible = false;

[XAML]
<chart:NumericalAxis IsVisible = false/>

Thanks,
Rajasekar

Jono
Replied On April 10, 2015 12:04 AM UTC

Is there a way to hide the axis labels etc but keep any striplines contained in the axis? Or perhaps set a stripline outside of the axis?

Any help is appreciated.

Cheers,
Jono

Magesh Kumar Krishnan [Syncfusion]
Replied On April 10, 2015 08:36 AM UTC

Hi Jono,

We suspect that you are telling TickLine as StripLine and we can hide the axis labels alone (without hiding TickLine) by setting FontSize to 0.01 as shown in the below code snippet.


Code snippet:

[C#]
Axis.LabelStyle.Font = Font.SystemFontOfSize(0.01d);

[XAML]
<chart:NumericalAxis>
<chart:NumericalAxis.LabelStyle>
<chart:ChartAxisLabelStyle Font="0.01"/>
</chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>


Note: If this is not your requirement please provide us more information regarding your requirement.

Please let us know if you need any further assistance on this.

Thanks,
Magesh Kumar K

Codrina Merigo
Replied On November 7, 2018 03:47 PM UTC

Hello,

It is possible to hide/set font size only for some labels in the graph ?

For example I don' t want to see the minimum(first) and maximum(last) on the axis as they are calculated programmatically in order to set the graph on the layout.

Thank you.

Michael Prabhu M [Syncfusion]
Replied On November 8, 2018 09:08 AM UTC

Hi Codrina, 

We have analyzed your requirement and we can achieve this with the help of LabelCreated event in ChartAxis. Please refer the below UG link for more details about LabelCreated event. 



Code snippet[Xaml] 
<chart:CategoryAxis LabelCreated="CategoryAxis_LabelCreated"> 
</chart:CategoryAxis> 
 

Code snippet[C#] 
private void CategoryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) 
{             
    if (e.Position == 0 || e.Position == 8) 
    { 
       e.LabelStyle = new ChartAxisLabelStyle(); 
        e.LabelStyle.FontSize = 0.01f; 
    } 
} 
 

We have also created a sample based on this and it can be downloaded from the link below. 


Hope this helps. 

Thanks, 
Michael 


Codrina Merigo
Replied On November 8, 2018 11:28 AM UTC

Thank you for the hint! As I had a datetime axis I managed to hide them by using:

[c#]
 private void DateTimeAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e)
        {
            double timestart;
            double timeend;

            Syncfusion.SfChart.XForms.DateTimeAxis chart = (Syncfusion.SfChart.XForms.DateTimeAxis)sender;

            timestart = chart.VisibleMinimum;
            timeend = chart.VisibleMaximum;

            if (e.Position == timestart || e.Position == timeend)
            {
                e.LabelStyle = new ChartAxisLabelStyle();
                e.LabelStyle.FontSize = 0.01f;
            }
        }




Michael Prabhu M [Syncfusion]
Replied On November 8, 2018 11:42 AM UTC

Hi Codrina, 
 
Thanks for the update, glad we could help. Feel free to contact us any time if you need any assistance from us. We are happy to help you. 
 
Regards, 
Michael 



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;