TimeAxis
A class representing the time axis of the scheduler. The scheduler timescale is based on the ticks generated by this class. This is a pure "data" (model) representation of the time axis and has no UI elements.
The time axis can be continuous or not. In continuous mode, each timespan starts where the previous ended, and in non-continuous mode there can be gaps between the ticks. A non-continuous time axis can be used when want to filter out certain periods of time (like weekends) from the time axis.
To create a non-continuous time axis you have 2 options. First, you can create a time axis containing only the time spans of interest. To do that, subclass this class and override the generateTicks method.
The other alternative is to call the filterBy method, passing a function to it which should return false if the time tick should be filtered out. Calling clearFilters will return you to a full time axis.
// Filter out weekends from the time axis
scheduler.timeAxis.filterBy(tick => tick.startDate.getDay() !== 0 && tick.startDate.getDay() !== 6);
// Restore the full time axis
scheduler.timeAxis.clearFilters();
Useful configs and functions
| Member | Description |
|---|---|
| continuous | Set false for non-continuous timelines |
| include | Include only certain hours or days |
| autoAdjust | Auto-adjust timespan when generating ticks |
| generateTicks | Custom tick generation method |
| reconfigure | Fires after time axis is reconfigured |
| beforeReconfigure | Fires before reconfiguration |
See also
- ViewPreset - defines the tick unit and header layout
- PresetManager - built-in preset collection
- TimelineZoomable - zoom-level API on the timeline view
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Automatically adjust the timespan when generating ticks with generateTicks according to the
viewPresetconfiguration. Setting this to false may lead to shifting time/date of ticks. -
Set to
falseif the timeline is not continuous, e.g. the next timespan does not start where the previous ended (for example skipping weekends etc).
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of TimeAxis class, or subclass thereof.
-
The current end date of the time axis. {@note}This is after filtering for workingTime and so may not be the same as the configured start date.{/note}
-
Returns
trueif the time axis is continuous (will returnfalsewhen filtered) -
The current start date of the time axis. {@note}This is after filtering for workingTime and so may not be the same as the configured start date.{/note}
-
Returns the ticks of the timeaxis in an array of objects with a "startDate" and "endDate".
-
The configured end date of the time axis before workingTime filtering
-
The configured start date of the time axis before workingTime filtering
-
Get the currently used time unit for the ticks
-
Get/set currently used preset
-
Identifies an object as an instance of TimeAxis class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
roundDate( )private
Rounds the date to nearest unit increment
-
updateTickCache( )private
Caches ticks and start/end dates for faster processing during rendering of events.
-
validateTickCount( )private
Checks if date range is in bounds of allowed and throws and exception if not