All docs
V19.2
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
A newer version of this page is available. Switch to the current version.

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.v19.2.dll

Declaration

[DXCategory("Events")]
public event RequestTimescaleRulersEventHandler RequestTimescaleRulers
<DXCategory("Events")>
Public Event RequestTimescaleRulers As RequestTimescaleRulersEventHandler

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.

Examples

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