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
Configs
4Common
Other
Properties
5
Properties
5Class hierarchy
Misc
Other
Functions
14
Functions
14Date mapping
Gets the date for a position on the time axis
| Parameter | Type | Description |
|---|---|---|
position | Number | The page X or Y coordinate |
roundingMethod | floor | 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 |
allowOutOfRange | Boolean | By default, this returns |
the Date corresponding to the xy coordinate
Returns the distance in pixels for a timespan with the given start and end date.
| Parameter | Type | Description |
|---|---|---|
start | Date | start date |
end | Date | end date |
The length of the time span
Returns the distance in pixels for a time span
| Parameter | Type | Description |
|---|---|---|
durationMS | Number | Time span duration in ms |
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.
| Parameter | Type | Description |
|---|---|---|
date | Date | the date to query for. |
the coordinate representing the date
Other
Events
5
Events
5Fires after the model has been reconfigured.
// Adding a listener using the "on" method
timeAxisViewModel.on('reconfigure', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TimeAxisViewModel | The model instance |
Fires after the model has been updated.
// Adding a listener using the "on" method
timeAxisViewModel.on('update', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TimeAxisViewModel | The model instance |
Event handlers
5
Event handlers
5Called after the model has been reconfigured.
new TimeAxisViewModel({
onReconfigure({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TimeAxisViewModel | The model instance |
Called after the model has been updated.
new TimeAxisViewModel({
onUpdate({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TimeAxisViewModel | The model instance |