Creating a Timeline
Creates a KronoGraph timeline in your web page within the specified DOM element.
The timeline sets its height and width to equal the size of its parent element,
or 100px if the parent does not have these.
We recommend styling the parent of the timeline, not the timeline itself.
The created Timeline object.
Timeline
The Timeline
component draws items passed to the set() function.
When new or updated data is passed in, it will redraw with the new items.
Gets a copy of an object describing the timeline annotations.
A copy of the current annotations, in a dictionary object indexed by id.
Sets the timeline annotations, replacing any existing annotations.
A copy of the current annotations, in a dictionary object indexed by id.
Destroys the current instance of the timeline, freeing any allocated resources.
Expands entities by adding sub-rows to vertically space out events as specified by the
expandedRows options. See also
Expanded Rows.
An object containing the ids of the entities whose rows are to be expanded, and the expansion mode being used.
Expands entities by adding sub-rows to vertically space out events as specified by the
expandedRows options. See also
Expanded Rows.
An object containing the ids of the entities whose rows are to be expanded, and the expansion mode being used.
Exports a static image of the timeline. The exported image is encoded in a blob URL.
A promise that will resolve with an object containing the blob URL of the exported image or reject with an error.
Fits all the events and time series chart data points into the viewport. If
Scale Wrapping is used, fits the wrapped time range into the viewport.
Sets the timeline focus to the specified entities or events. When the timeline is focused, only focused items and their connections are shown. Focused events will keep the entities they are linked to in focus. Focusing does not affect time series charts.
The ids of the focused items.
Gets the ids of the focused entities or events. When focus items are set, only those items and their connections are shown.
The ids of the focused items.
Gets an object describing the position of an annotation's body.
Returns
AnnotationBodyPosition | null
Returns a copy of the entity with the specified id.
A copy of the
Entity object, or null if there is no entity with the specified id.
Gets an object describing the position of an entity.
Parameters
required
The id of the entity.
Returns
EntityPosition | null
An
EntityPosition object, or null if the entity is not shown in the timeline.
Returns a copy of the event with the specified id.
A copy of the
Event object, or null if there is no event with the specified id.
Gets an object describing the position of an event.
Parameters
required
The id of the event.
Returns
EventPosition | null
An
EventPosition object, or null if the event is not in the current timeline range.
Returns an object detailing the ids of events and entities that are in the current range.
Returns
{ entities: Object, events: Object }
Objects whose keys are the ids of entities and events in the current range.
Returns the ids of entities that are pinned.
The ids of the pinned items.
Returns the ids of the entities in the specified row.
Parameters
required
The id of the row.
An array of the entity ids, or null if there is no entity row with the specified id.
Gets the ids of highlighted rows and entities.
The ids of highlighted rows and entities.
Sets the highlighted rows and entities. Highlighted rows and entities are drawn with a distinct
highlightColor.
The ids of highlighted rows and entities.
Determines whether a time or event is within the timeline's visible range.
Parameters
required
A Date in local time, a millisecond number in UTC, a TimeRange
object, or the id of an event.
The number of nanoseconds to add to the Date or number.
Whether the specified item is within the timeline's visible range.
Determines whether the heatmap is currently shown.
True if the heatmap is currently shown, otherwise false.
Gets the mode of calculation for the width of the entity label area and its width.
An object containing the mode of calculation for the width of the entity label area and its width.
Sets the mode of calculation for the width of the entity label area and, if 'fixed', its width.
An object containing the mode of calculation for the width of the entity label area and its width.
Gets the id of the entity at the center of the lens view.
The id of the entity at the center of the lens view, or null if lens view isn't open.
Sets the entity at the center of the lens view. Set it to null to close lens view.
Parameters
required
The id of the entity.
The id of the entity at the center of the lens, or null if lens view isn't open.
Gets a copy of the timeline markers.
A copy of the current markers.
Sets the timeline markers.
A copy of the current markers.
Detaches an event handler from an event fired by the timeline. See
Handling Events.
Attaches an event handler to an event fired by the timeline. See
Handling Events.
Gets the current timeline options.
The currently specified options.
Sets the timeline options.
The currently specified options.
Pans the timeline in the specified direction. The panning range is limited and depends on the timeline data.
Pins or unpins the specified entities. Pinned entities are always shown separately from entity groups.
Adds an animated effect to a specified event or events, and then removes it again.
Gets the range of time currently shown in the timeline. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
An object containing the range of visible times:
start
the start of the visible time range, as a Date object. end
the end of the visible time range, as a Date object. startNanoseconds
the number of nanoseconds to add to start
. endNanoseconds
the number of nanoseconds to add to end
.
Sets the range of times currently shown by the timeline. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping. There are limits to the range that can be set, which depend on the timeline data.
Parameters
required
The start of the range as a Date in local time, or a millisecond number in UTC.
required
The end of the range as a Date in local time, or a millisecond number in UTC.
The number of nanoseconds to add to start.
The number of nanoseconds to add to end.
An object containing the range of visible times:
start
the start of the visible time range, as a Date object. end
the end of the visible time range, as a Date object. startNanoseconds
the number of nanoseconds to add to start
. endNanoseconds
the number of nanoseconds to add to end
.
Gets the event ids of all revealed events.
The ids of the revealed events.
Sets the underlying events to be revealed when the heatmap view is shown.
The ids of the revealed events.
Gets the ids of the selected events.
The ids of the selected events.
Sets the selected events. Selected events are drawn with a highlight.
The ids of the selected events.
Gets a flag indicating whether the timeline is in selection mode.
True if the timeline is in selection mode, otherwise false.
Sets the selection mode.
True if the timeline is in selection mode, otherwise false.
Replaces the timeline data with the new data specified. Any existing items in the timeline will be removed. See
Data Formats.
Sets the location of the timeline in the DOM. Set to null to temporarily remove the timeline.
Sets the type of entity ordering to use in the timeline.
Zoom the timeline in the manner specified. The zooming range is limited and depends on the timeline data.
Handling Events
KronoGraph lets you respond to various events fired by the timeline, which can be triggered either by user interaction or by items changing in the timeline.
Use the on() function to attach an event handler to an event. To detach it, use the off() function.
When an event fires, any attached event handlers are passed a single object containing all the details of the event.
To override the default behavior of an event, call the preventDefault()
function in the event handler.
Fires when the current annotations change.
Fires when the user clicks or taps on the timeline.
Default actions:
- Focus control - Focuses or unfocuses the entity row.
- Pin control - Pins or unpins the entity row.
- Annotation delete control - Deletes the annotation.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires on a right click or a long press on the timeline.
Default action:
- Suppresses the click event.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires on a double click or a double tap on the timeline.
Default actions:
- On the background - Unfocuses any focused entity rows.
- On an entity row - Focuses or unfocuses the entity row.
- On the scale - Sets the timeline range to the
startTime
and endTime
properties of the selected scale item.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires when the drag is finished and pointer is released, or when the drag is canceled. On touch devices this fires when the finger or pointing device is lifted.
Default action:
- On
MarqueeRange
drag type - the timeline will zoom into the selected range.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The type of drag.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The entity range within the dragged area. Only present when dragType is 'marqueeSelection'.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires continuously as the cursor moves during a drag.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The type of drag.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires when a drag is started. Use
setDragOptions
to set the dragging behavior.
Default actions:
- On the background - Pans the timeline.
- On the scale - Draws a marquee range. On
drag-end
, the default action is to zoom into the selected range. - On the entity label area border - Adjusts the label area width.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The type of drag.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
Controls the dragging behavior.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires each time the timeline is drawn. The handler for this event is not passed any arguments.
Fires when the set of entities whose rows are to be expanded (if space allows) changes.
Fires when the list of focused items changes.
Fires when the list of highlighted items changes.
Fires when the user hovers over the timeline. Pass the hover
property to the options()
function to configure the hover delay.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires when the user presses a key.
Default actions:
- Escape key - Cancels an active drag.
- Shift key - Draws a marquee range when dragging.
required
A read-only value indicating whether the default action was prevented.
required
The keyCode of the key pressed.
required
An object describing which modifier keys were pressed when the event occurred.
If called, the default action is prevented.
Fires when the user releases a key.
required
A read-only value indicating whether the default action was prevented.
required
The keyCode of the key pressed.
required
An object describing which modifier keys were pressed when the event occurred.
If called, the default action is prevented.
Fires when the entity at the center of the lens changes, for example, when the user scrolls through lens view.
Fires when an entity is pinned or unpinned.
Fires when a pointer presses down on the timeline.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires continuously as the pointer moves on the timeline, or the timeline moves beneath the pointer.
Default action:
- On an entity row - Highlights the entity row and displays available controls (pin or focus).
- On a time series chart - Highlights the nearest data point.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires when the pointer is released.
required
The index of the button used.
required
A read-only value indicating whether the default action was prevented.
required
The number of nanoseconds to add to endTime.
required
The end of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An array of ids of events within the targeted item. Only defined if targetType
is event
, eventSummary
or cell
.
required
The id of the targeted item.
required
The label of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
required
The unique identifier of the pointer.
required
The type of pointing device: mouse, touch or pen.
If called, the default action is prevented.
required
The number of nanoseconds to add to startTime.
required
The start of the time range covered by the targeted item. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
An object containing details of the sub-item, or undefined if the cursor is not over a sub-item.
required
The type of the targeted item.
required
The timeline time corresponding to the pointer position. When the scale is wrapped, this is relative to the base range - see
Scale Wrapping.
required
The number of nanoseconds to add to time.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.
Fires when the time range shown in the timeline changes.
Fires when the list of selected events changes.
Fires continuously while the user is vertically or horizontally scrolling.
Default actions:
- Vertical scrolling on the background - Zooms the timeline.
- Vertical scrolling on the entity label area - Scrolls lens view up or down.
- Horizontal scrolling - Pans the timeline.
required
A read-only value indicating whether the default action was prevented.
required
The unit of measurement for the delta value.
required
The number of units that the wheel scrolled in the x direction.
required
The number of units that the wheel scrolled in the y direction.
required
The id of the targeted item.
required
An object describing which modifier keys were pressed when the event occurred.
If called, the default action is prevented.
required
The type of the targeted item.
required
The distance from the left edge of the Timeline
element to the pointer position.
required
The distance from the top edge of the Timeline
element to the pointer position.