TimeAxisViewModel

This class is an internal view model class, describing the visual representation of a TimeAxis. The config for the header rows is described in the headers. To calculate the size of each cell in the time axis, this class requires:

  • availableSpace - The total width or height available for the rendering
  • tickSize - The fixed width or height of each cell in the lowest header row. This value is normally read from the viewPreset but this can also be updated programmatically using the tickSize setter

Normally you should not interact with this class directly.

Configs

4

Properties

5

Class hierarchy

isTimeAxisViewModel: Boolean= truereadonly
Identifies an object as an instance of TimeAxisViewModel class, or subclass thereof.
isTimeAxisViewModel: Boolean= truereadonlystatic
Identifies an object as an instance of TimeAxisViewModel class, or subclass thereof.
isEventsEvents

Misc

Other

Functions

14

Date mapping

Gets the date for a position on the time axis

ParameterTypeDescription
positionNumber

The page X or Y coordinate

roundingMethodfloor | round | ceil

Rounding method to use. 'floor' to take the tick (lowest header in a time axis) start date, 'round' to round the value to nearest increment or 'ceil' to take the tick end date

allowOutOfRangeBoolean

By default, this returns null if the position is outside of the time axis. Pass true to attempt to calculate a date outside of the time axis.

Returns: Date -

the Date corresponding to the xy coordinate

Returns the distance in pixels for a timespan with the given start and end date.

ParameterTypeDescription
startDate

start date

endDate

end date

Returns: Number -

The length of the time span

Returns the distance in pixels for a time span

ParameterTypeDescription
durationMSNumber

Time span duration in ms

Returns: Number -

The length of the time span

Gets the position of a date on the projected time axis or -1 if the date is not in the timeAxis.

ParameterTypeDescription
dateDate

the date to query for.

Returns: Number -

the coordinate representing the date

Other

onEvents
relayAllEvents
triggerEvents
unEvents

Events

5

Fires after the model has been reconfigured.

// Adding a listener using the "on" method
timeAxisViewModel.on('reconfigure', ({ source }) => {

});
ParameterTypeDescription
sourceTimeAxisViewModel

The model instance

Fires after the model has been updated.

// Adding a listener using the "on" method
timeAxisViewModel.on('update', ({ source }) => {

});
ParameterTypeDescription
sourceTimeAxisViewModel

The model instance

catchAllEvents
destroyEvents

Event handlers

5

Called after the model has been reconfigured.

new TimeAxisViewModel({
    onReconfigure({ source }) {

    }
});
ParameterTypeDescription
sourceTimeAxisViewModel

The model instance

Called after the model has been updated.

new TimeAxisViewModel({
    onUpdate({ source }) {

    }
});
ParameterTypeDescription
sourceTimeAxisViewModel

The model instance

onDestroyEvents

Typedefs

1