- Home
- Forum
- Xamarin.Forms
- Hide Axis Labels
Hide Axis Labels
I can set MaximumLabels="0 but a label for lowest and highest value is still shown.
How can I hide all labels of an axis?
SIGN IN To post a reply.
9 Replies
MK
Magesh Kumar Krishnan
Syncfusion Team
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
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
MD
Markus Demmler
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?
RB
Rajasekar B
Syncfusion Team
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
JO
Jono
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
MK
Magesh Kumar Krishnan
Syncfusion Team
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.
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
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: |
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
CM
Codrina Merigo
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.
MP
Michael Prabhu M
Syncfusion Team
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.
Sample: 117975_hide-axis-labels
Hope this helps.
Thanks,
Michael
CM
Codrina Merigo
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;
}
}
MP
Michael Prabhu M
Syncfusion Team
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
SIGN IN To post a reply.
- 9 Replies
- 6 Participants
-
MD Markus Demmler
- Jan 15, 2015 01:43 PM UTC
- Nov 8, 2018 11:42 AM UTC