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

How to add labels for the last day of a month in a DateTimeAxis with zooming

Thread ID:

Created:

Updated:

Platform:

Replies:

123548 Mar 29,2016 10:34 AM UTC Apr 6,2016 10:34 AM UTC Xamarin.Android 7
loading
Tags: SfChart
Naryoril
Asked On March 29, 2016 10:34 AM UTC

Hi

How do i add labels for a DateTimeAxis for the last day of the month?

If i set Interval to 1 and IntervalType to Months, i get labels for the first day of the month.

I can achieve it by setting Interval to 1, IntervalType to Days and MaximumLabels to a very high number (e.g. 366 since i want to display one year). Then i can register to the LabelCreated event, and in there check if the label to be created belongs to the last day of the month, and if not setting the LabelContent to an empty string. It works in general this way, but the higher the MaximumLabels number is, the slower zooming becomes (even if i don't handle the event). At 100, zooming is so slow that it's unusable, and i don't get the labels for each month. At 366 it is so slow that there is no response until android asks if i want to close the app since it isn't responding.

So is there a way to do this while still enabling zooming?

Yuvaraj Palanisamy [Syncfusion]
Replied On March 31, 2016 01:08 AM UTC

Hi Rafael,

Thanks for using Syncfusion products.

We have analyzed your query and have prepared a workaround sample using generateVisibleLabels method of ChartAxis. Please find the sample from the below location.

Sample: http://www.syncfusion.com/downloads/support/forum/123548/ze/SimpleSample-152156930

Thanks,
Yuvaraj P.

Naryoril
Replied On April 1, 2016 12:52 PM UTC

Hi

Thanks, this helps more or less, but one issue remains: If my chart has a range from 31/12/2014 to 31/12/2015, i won't have a label for 31/12/2015. Your method moves the label back one day, and there is no label for 1/1/2016 because it's outside of the chart's range. Unfortunately the constructor of ChartAxisLabel is protected, so i don't know how to create a new label to add it.
And if i set the Interval to 1 day, increase MaximumLabels and filter out the not needed labels in GenerateVisibleLabels, the zooming is slow again.

Kind regards
Rafael

Yuvaraj Palanisamy [Syncfusion]
Replied On April 4, 2016 09:12 PM UTC

Hi Rafael,

We have modified the sample based on your requirement and it can be downloaded from the following location. 

Sample: http://www.syncfusion.com/downloads/support/forum/123503/ze/SimpleSample-AxisLabel-196302069   

Thanks,
Yuvaraj

Naryoril
Replied On April 5, 2016 06:57 AM UTC

Hi Yuvaraj

Unfortunately, while it works for a ColumnSeries, it doesn't work for a LineSeries.

Kind regards
Rafael

Mohamed Samsudeen K S [Syncfusion]
Replied On April 6, 2016 06:23 AM UTC

Hi Rafael,

Thanks for the update.

We are unable to reproduce the reported issue in the provided sample. Please find the below image.



If you are still facing this issue, you can set the IntervalType property of DateTimeAxis to Month and Interval property to number of required intervals as shown in the below code snippet.


DateTimeAxisExt primaryAxis = new DateTimeAxisExt()

{

    IntervalType = DateTimeIntervalType.Months,

    Interval = 1
};


Please check and let us know if you have any queries.

Regards,
Samsudeen K S

Naryoril
Replied On April 6, 2016 06:52 AM UTC

HI Samsudeen

Even in your screenshot there is no label for 31/Dec/2015, which is exactly the remaining issue.

Kind regards
Rafael

Mohamed Samsudeen K S [Syncfusion]
Replied On April 6, 2016 10:34 AM UTC

Hi Rafael,

We have added a new feature in Essential Studio Volume 1, 2016 release called “EdgeLabelsVisibilityMode” for axis which can take values as Default, Visible and AlwaysVisible.

Default – The edge labels will be rounded to nearest value in order to get the nice labels.

Visible - The edge labels will be visible even if it is not a rounded value. But, the edge labels will not be visible while zooming.

AlwaysVisible – Works exactly like “Visible” mode. But, the edge labels will be visible while zooming.


Using this feature, we have achieved your requirement and updated the sample.

http://www.syncfusion.com/downloads/support/forum/123548/ze/SimpleSample1163847207

Please upgrade to the latest version which is available for download under the following link:
                          
Link: http://www.syncfusion.com/forums/123633/essential-studio-2016-volume-1-release-v14-1-0-41-is-available-for-download

Regards,
Samsudeen K S


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

;