windowsforms-devexpress-dot-xtragantt-dot-ganttcontrol-d293d5a4.md
Fires when the chart is zoomed in / zoomed out. Allows you to customize the timescale rulers.
Namespace : DevExpress.XtraGantt
Assembly : DevExpress.XtraGantt.v25.2.dll
NuGet Package : DevExpress.Win.Gantt
[DXCategory("Events")]
public event RequestTimescaleRulersEventHandler RequestTimescaleRulers
<DXCategory("Events")>
Public Event RequestTimescaleRulers As RequestTimescaleRulersEventHandler
The RequestTimescaleRulers event's data class is RequestTimescaleRulersEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| TimescaleRulers | Provides access to the chart’s timescale rulers. |
The event data class exposes the following methods:
| Method | Description |
|---|---|
| GetTimescaleUnitWidth(GanttTimescaleUnit) | Returns the width of the specified measure unit on the timescale. |
The timescale can display between one and three rulers. Rulers display different measure units depending on the zoom factor: years-quarters-months, months-days-hours, etc.
The code below shows how to change the date-time format depending on the time scale ruler’s measure unit.
using DevExpress.XtraGantt;
private void ganttControl1_RequestTimescaleRulers(object sender, DevExpress.XtraGantt.RequestTimescaleRulersEventArgs e) {
GanttTimescaleRuler ruler0 = e.TimescaleRulers[0];
if (ruler0.Unit == GanttTimescaleUnit.Month)
ruler0.DisplayFormat = "MMM yy";
GanttTimescaleRuler ruler1 = e.TimescaleRulers[1];
if (ruler1.Unit == GanttTimescaleUnit.Day)
ruler1.DisplayFormat = "dddd, d";
}
Private Sub ganttControl1_RequestTimescaleRulers(ByVal sender As Object, ByVal e As RequestTimescaleRulersEventArgs) _
Handles ganttControl1.RequestTimescaleRulers
Dim ruler0 As GanttTimescaleRuler = e.TimescaleRulers(0)
If ruler0.Unit = GanttTimescaleUnit.Month Then
ruler0.DisplayFormat = "MMM yy"
End If
Dim ruler1 As GanttTimescaleRuler = e.TimescaleRulers(1)
If ruler1.Unit = GanttTimescaleUnit.Day Then
ruler1.DisplayFormat = "dddd, d"
End If
End Sub
See Also