How to customize the timescale label format?
Description:
This article describes how to customize the Timescale label format in UWP Gantt.
Solution:
This requirement can be achieved by setting the corresponding label format property in timescale tier. Each interval type having separate label format property.
For example, if the IntervalType is Weeks, then need to set the label format in the WeeksLabelFormat property.
Gantt supports framework supported formats and some inbuild formats.
Inbuilt format strings
IntervalType | Format string | Output |
Years | MMM dd, ’yy | Jan 01,’10 |
Quarter | Quarter | 1st Quarter, 2nd Quarter, … |
Q | Q1, Q2, … | |
Q’yy | Q1’10, Q2’10, … | |
Months | MMM:1 | J, F, M… |
Weeks | ddd MMM dd,’yy | Sun Jan 01,’10, … |
ddd MMMM dd,’yy | Sun January 01, ’10, … | |
Days | ddd:1 | S, M, T, … |
ddd:2 | Su, Mo, Tu, … |
The following code sample illustrates the usage of WeeksLabelFormat property usage
[XAML]
<gantt:TimescaleSettings.TopTier> <gantt:TimescaleTier IntervalType="Weeks" WeeksLabelFormat="ddd MM/dd/yy"/> </gantt:TimescaleSettings.TopTier>
[C#]
this.Gantt.TimescaleSettings.TopTier.IntervalType = IntervalType.Weeks; this.Gantt.TimescaleSettings.TopTier.WeeksLabelFormat = "ddd MM/dd/yy";
The following screenshot is the output of the above code.
Please find the required sample from the link.
I hope you enjoyed learning about how to customize the timescale label format.
You can refer to our UWP Gantt’s feature tour page to know about its other groundbreaking feature representations. You can also explore our UWP Gantt documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our UWP Gantt and other UWP components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!