Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GanttControl.RequestTimescaleRulers Event

Fires when the chart is zoomed in / zoomed out. Allows you to customize the timescale rulers.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.2.dll

NuGet Package: DevExpress.Win.Gantt

#Declaration

[DXCategory("Events")]
public event RequestTimescaleRulersEventHandler RequestTimescaleRulers

#Event Data

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.

#Remarks

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.

image

image

#Example

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";
}
See Also