Class links.Timeline
Defined in: timeline.js.
Constructor Attributes | Constructor Name and Description |
---|---|
links.Timeline(container, options)
|
Method Attributes | Method Name and Description |
---|---|
<static> |
links.Timeline.addClassName(elem, className)
Adds one or more className's to the given elements style
|
<static> |
links.Timeline.addEventListener(element, action, listener, useCapture)
Add and event listener.
|
addItem(itemData, preventRender)
Add a new item.
|
|
addItems(itemsData, preventRender)
Add new items.
|
|
addItemType(typeName, typeFactory)
Add new type of items
|
|
applyRange(start, end, zoomAroundDate)
Apply a visible range.
|
|
Cancel creation of a new item
This method can be called insed an event listener which catches the "new"
event.
|
|
Cancel a change item
This method can be called insed an event listener which catches the "change"
event.
|
|
Cancel deletion of an item
This method can be called insed an event listener which catches the "delete"
event.
|
|
changeItem(index, itemData, preventRender)
Edit an item
|
|
Check if the timeline is resized, and if so, redraw the timeline.
|
|
This method clears the (internal) array this.items in a safe way: neatly
cleaning up the DOM, and accompanying arrays this.renderedItems and
the created clusters.
|
|
<static> |
links.Timeline.clone(object)
Shallow clone an object
|
Cluster the events
|
|
collision(item1, item2, margin)
Test if the two provided items collide
The items must have parameters left, right, top, and bottom.
|
|
confirmDeleteItem(index)
Delete an item after a confirmation.
|
|
createItem(itemData)
Create an item object, containing all needed parameters
|
|
Delete all items
|
|
Delete all groups
|
|
deleteItem(index, preventRender)
Delete an item
|
|
draw(data, options)
Main drawing logic.
|
|
Filter the visible events
|
|
finalItemsPosition(items, groupBase, group)
|
|
<static> |
links.Timeline.getAbsoluteLeft(elem)
Retrieve the absolute left value of a DOM element
|
<static> |
links.Timeline.getAbsoluteTop(elem)
Retrieve the absolute top value of a DOM element
|
getCluster(index)
Retrieve the properties of a cluster.
|
|
getClusterIndex(element)
Find the cluster index from a given HTML element
If no cluster index is found, undefined is returned
|
|
Get current time.
|
|
Retrieve the current custom time.
|
|
getData()
Return the original data table.
|
|
getDataRange(withMargin)
Get the date range of the items.
|
|
getGroup(groupName)
Get a group by the group name.
|
|
getGroupFromHeight(height)
Find the group from a given height in the timeline
|
|
getGroupName(groupObj)
Get the group name from a group object.
|
|
getItem(index)
Retrieve the properties of an item.
|
|
getItemIndex(element)
Find the item index from a given HTML element
If no item index is found, undefined is returned
|
|
getItemsByGroup(items)
|
|
Get options for the timeline.
|
|
<static> |
links.Timeline.getPageX(event)
Get the absolute, horizontal mouse position from an event.
|
<static> |
links.Timeline.getPageY(event)
Get the absolute, vertical mouse position from an event.
|
Retrieve the currently selected event
|
|
<static> |
links.Timeline.getTarget(event)
Get HTML element which is the target of the event
|
Retrieve the current visible range in the timeline.
|
|
getVisibleItems(start, end)
Find all elements within the start and end range
If no element is found, returns an empty array
|
|
initialItemsPosition(items, groupBase)
|
|
<static> |
links.Timeline.isArray(obj)
Check if given object is a Javascript Array
|
isEditable(item)
Check whether a given item is editable
|
|
isSelected(index)
Check if an item is currently selected
|
|
<static> |
links.Timeline.mapColumnIds(dataTable)
Retrieve a map with the column indexes of the columns by column name.
|
move(moveFactor)
Move the timeline the given movefactor to the left or right.
|
|
onDblClick(event)
Double click event occurred for an item
|
|
onMouseDown(event)
Start a moving operation inside the provided parent element
|
|
onMouseMove(event)
Perform moving operating.
|
|
onMouseUp(event)
Stop moving operating.
|
|
onMouseWheel(event)
Event handler for mouse wheel event, used to zoom the timeline
Code from http://adomas.org/javascript-mouse-wheel/
|
|
onTouchEnd(event)
Event handler for touchend event on mobile devices
|
|
onTouchMove(event)
Event handler for touchmove event on mobile devices
|
|
onTouchStart(event)
Event handler for touchstart event on mobile devices
|
|
<static> |
links.Timeline.parseJSONDate(date)
parse a JSON date
|
<static> |
links.Timeline.preventDefault(event)
Cancels the event if it is cancelable, without stopping further propagation of the event.
|
Calculate the factor and offset to convert a position on screen to the
corresponding date and vice versa.
|
|
Recalculate item properties:
- the height of each group.
|
|
redraw()
Redraw the timeline
Reloads the (linked) data table and redraws the timeline when resized.
|
|
Reflow the timeline axis.
|
|
Reflow the timeline frame
|
|
Reflow the size of the groups
|
|
Reflow all items, retrieve their actual size
|
|
<static> |
links.Timeline.removeClassName(elem, className)
Removes one or more className's from the given elements style
|
<static> |
links.Timeline.removeEventListener(element, action, listener, useCapture)
Remove an event listener from an element
|
render(options)
Re-render (reflow and repaint) all components of the Timeline: frame, axis,
items, .
|
|
repaint()
Repaint all components of the Timeline
|
|
Redraw the timeline axis with minor and major labels
|
|
Create characters used to determine the size of text on the axis
|
|
End of overwriting HTML DOM elements of the axis.
|
|
Repaint the horizontal line and background of the axis
|
|
Create a Major line for the axis at position x
|
|
repaintAxisMajorText(x, text)
Create a Major label for the axis at position x
|
|
Create a minor line for the axis at position x
|
|
repaintAxisMinorText(x, text)
Create a minor label for the axis at position x
|
|
Initialize redraw of the axis.
|
|
Redraw the current time bar
|
|
Redraw the custom time bar
|
|
Redraw the delete button, on the top right of the currently selected item
if there is no item selected, the button is hidden.
|
|
Redraw the drag areas.
|
|
repaint the Timeline frame
|
|
Redraw the group labels
|
|
Repaint all items
|
|
Create the navigation buttons for zooming and moving
|
|
screenToTime(x)
Convert a position on screen (pixels) to a datetime
Before this method can be used, the method calcConversionFactor must be
executed once.
|
|
selectCluster(index)
Select an cluster by its index
|
|
selectItem(index)
Select an item by its index
|
|
setAutoScale(enable)
Enable or disable autoscaling
|
|
setCurrentTime(time)
Set current time.
|
|
setCustomTime(time)
Set custom time.
|
|
setData(data)
Set data for the timeline
|
|
setOptions(options)
Set options for the timeline.
|
|
setScale(scale, step)
Set a custom scale.
|
|
setSelection(selection)
Select an event.
|
|
setSize(width, height)
Set a new size for the timeline
|
|
setVisibleChartRange(start, end, redraw)
Set a new value for the visible range int the timeline.
|
|
Change the visible chart range such that all items become visible
|
|
Adjust the visible range such that the current time is located in the center
of the timeline
|
|
stackCalculateFinal(items)
Adjust vertical positions of the events such that they don't overlap each
other.
|
|
Cancel any running animation
|
|
stackItems(animate)
Stack the items such that they don't overlap.
|
|
stackItemsCheckOverlap(items, itemIndex, itemStart, itemEnd)
Check if the destiny position of given item overlaps with any
of the other items from index itemStart to itemEnd.
|
|
stackMoveOneStep(currentItems, finalItems)
Move the events one step in the direction of their final positions
|
|
stackMoveToFinal(currentItems, finalItems)
Move the events from their current position to the final position
|
|
stackOrder(items)
Order the items in the array this.items.
|
|
<static> |
links.Timeline.stopPropagation(event)
Stop event propagation
|
timeToScreen(time)
Convert a datetime (Date object) into a position on the screen
Before this method can be used, the method calcConversionFactor must be
executed once.
|
|
trigger(event)
fire an event
|
|
Unselect the currently selected event (if any)
|
|
updateData(index, values)
Update the original data with changed start, end or group.
|
|
zoom(zoomFactor, zoomAroundDate)
Zoom the timeline the given zoomfactor in or out.
|
Class Detail
links.Timeline(container, options)
- Parameters:
- {Element} container
- The DOM element in which the Timeline will be created. Normally a div element.
- {Object} options
- A name/value map containing settings for the timeline. Optional.
Method Detail
<static>
links.Timeline.addClassName(elem, className)
Adds one or more className's to the given elements style
- Parameters:
- {Element} elem
- {String} className
<static>
links.Timeline.addEventListener(element, action, listener, useCapture)
Add and event listener. Works for all browsers
- Parameters:
- {Element} element
- An html element
- {string} action
- The action, for example "click", without the prefix "on"
- {function} listener
- The callback function to be executed
- {boolean} useCapture
addItem(itemData, preventRender)
Add a new item.
- Parameters:
- {Object} itemData
- Object containing item properties:
{Date} start (required), {Date} end (optional), {String} content (required), {String} group (optional) {String} className (optional) {Boolean} editable (optional) {String} type (optional) - {boolean} preventRender Optional, Default: false
- Do not re-render timeline if true
addItems(itemsData, preventRender)
Add new items.
- Parameters:
- {Array} itemsData
- An array containing Objects. The objects must have the following parameters: {Date} start, {Date} end, {String} content with text or HTML code, {String} group (optional) {String} className (optional) {String} editable (optional) {String} type (optional)
- {boolean} preventRender Optional, Default: false
- Do not re-render timeline if true
addItemType(typeName, typeFactory)
Add new type of items
- Parameters:
- {String} typeName
- Name of new type
- {links.Timeline.Item} typeFactory
- Constructor of items
applyRange(start, end, zoomAroundDate)
Apply a visible range. The range is limited to feasible maximum and minimum
range.
- Parameters:
- {Date} start
- {Date} end
- {Date} zoomAroundDate
- Optional. Date around which will be zoomed.
cancelAdd()
Cancel creation of a new item
This method can be called insed an event listener which catches the "new"
event. Creation of the new the event will be undone.
cancelChange()
Cancel a change item
This method can be called insed an event listener which catches the "change"
event. The changed event position will be undone.
cancelDelete()
Cancel deletion of an item
This method can be called insed an event listener which catches the "delete"
event. Deletion of the event will be undone.
changeItem(index, itemData, preventRender)
Edit an item
- Parameters:
- {Number} index
- {Object} itemData
- Object containing item properties:
{Date} start (required), {Date} end (optional), {String} content (required), {String} group (optional) - {boolean} preventRender Optional, Default: false
- Do not re-render timeline if true
checkResize()
Check if the timeline is resized, and if so, redraw the timeline.
Useful when the webpage is resized.
clearItems()
This method clears the (internal) array this.items in a safe way: neatly
cleaning up the DOM, and accompanying arrays this.renderedItems and
the created clusters.
<static>
{Object}
links.Timeline.clone(object)
Shallow clone an object
- Parameters:
- {Object} object
- Returns:
- {Object} clone
clusterItems()
Cluster the events
{boolean}
collision(item1, item2, margin)
Test if the two provided items collide
The items must have parameters left, right, top, and bottom.
- Parameters:
- {Element} item1
- The first item
- {Element} item2
- The second item
- {Number} margin
- A minimum required margin. Optional. If margin is provided, the two items will be marked colliding when they overlap or when the margin between the two is smaller than the requested margin.
- Returns:
- {boolean} true if item1 and item2 collide, else false
confirmDeleteItem(index)
Delete an item after a confirmation.
The deletion can be cancelled by executing .cancelDelete() during the
triggered event 'delete'.
- Parameters:
- {int} index
- Index of the item to be deleted
{Object}
createItem(itemData)
Create an item object, containing all needed parameters
- Parameters:
- {Object} itemData
- Object containing parameters start, end content, group.
- Returns:
- {Object} item
deleteAllItems()
Delete all items
deleteGroups()
Delete all groups
deleteItem(index, preventRender)
Delete an item
- Parameters:
- {int} index
- Index of the item to be deleted
- {boolean} preventRender Optional, Default: false
- Do not re-render timeline if true (optimization for multiple delete)
draw(data, options)
Main drawing logic. This is the function that needs to be called
in the html page, to draw the timeline.
A data table with the events must be provided, and an options table.
- Parameters:
- {google.visualization.DataTable} data
- The data containing the events for the timeline. Object DataTable is defined in google.visualization.DataTable
- {Object} options
- A name/value map containing settings for the timeline. Optional. The use of options here is deprecated. Pass timeline options in the constructor or use setOptions()
filterItems()
Filter the visible events
finalItemsPosition(items, groupBase, group)
- Parameters:
- items
- groupBase
- group
<static>
{number}
links.Timeline.getAbsoluteLeft(elem)
Retrieve the absolute left value of a DOM element
- Parameters:
- {Element} elem
- A dom element, for example a div
- Returns:
- {number} left The absolute left position of this element in the browser page.
<static>
{number}
links.Timeline.getAbsoluteTop(elem)
Retrieve the absolute top value of a DOM element
- Parameters:
- {Element} elem
- A dom element, for example a div
- Returns:
- {number} top The absolute top position of this element in the browser page.
{Object}
getCluster(index)
Retrieve the properties of a cluster.
- Parameters:
- {Number} index
- Returns:
- {Object} clusterdata Object containing cluster properties:
{Date} start (required), {String} type (optional) {Array} array with item data as is in getItem()
{Number | undefined}
getClusterIndex(element)
Find the cluster index from a given HTML element
If no cluster index is found, undefined is returned
- Parameters:
- {Element} element
- Returns:
- {Number | undefined} index
{Date}
getCurrentTime()
Get current time. The time can have an offset from the real time, when
the current time has been changed via the method setCurrentTime.
- Returns:
- {Date} time
{Date}
getCustomTime()
Retrieve the current custom time.
- Returns:
- {Date} customTime
{google.visualization.DataTable | Array}
getData()
Return the original data table.
- Returns:
- {google.visualization.DataTable | Array} data
{Object}
getDataRange(withMargin)
Get the date range of the items.
- Parameters:
- {boolean} withMargin Optional
- If true, 5% of whitespace is added to the left and right of the range. Default is false.
- Returns:
- {Object} range An object with parameters min and max. - {Date} min is the lowest start date of the items - {Date} max is the highest start or end date of the items If no data is available, the values of min and max will be undefined
{Object}
getGroup(groupName)
Get a group by the group name. When the group does not exist,
it will be created.
- Parameters:
- {String} groupName
- the name of the group
- Returns:
- {Object} groupObject
{Object | undefined}
getGroupFromHeight(height)
Find the group from a given height in the timeline
- Parameters:
- {Number} height
- Height in the timeline
- Returns:
- {Object | undefined} group The group object, or undefined if out of range
{String}
getGroupName(groupObj)
Get the group name from a group object.
- Parameters:
- {Object} groupObj
- Returns:
- {String} groupName the name of the group, or undefined when group was not provided
{Object}
getItem(index)
Retrieve the properties of an item.
- Parameters:
- {Number} index
- Returns:
- {Object} itemData Object containing item properties:
{Date} start (required), {Date} end (optional), {String} content (required), {String} group (optional), {String} className (optional) {boolean} editable (optional) {String} type (optional)
{Number | undefined}
getItemIndex(element)
Find the item index from a given HTML element
If no item index is found, undefined is returned
- Parameters:
- {Element} element
- Returns:
- {Number | undefined} index
getItemsByGroup(items)
- Parameters:
- items
getOptions()
Get options for the timeline.
- Returns:
- the options object
<static>
{Number}
links.Timeline.getPageX(event)
Get the absolute, horizontal mouse position from an event.
- Parameters:
- {Event} event
- Returns:
- {Number} pageX
<static>
{Number}
links.Timeline.getPageY(event)
Get the absolute, vertical mouse position from an event.
- Parameters:
- {Event} event
- Returns:
- {Number} pageY
{Array}
getSelection()
Retrieve the currently selected event
- Returns:
- {Array} sel An array with a column row, containing the row number of the selected event. If there is no selection, an empty array is returned.
<static>
{Element}
links.Timeline.getTarget(event)
Get HTML element which is the target of the event
- Parameters:
- {Event} event
- Returns:
- {Element} target element
{Object}
getVisibleChartRange()
Retrieve the current visible range in the timeline.
- Returns:
- {Object} An object with start and end properties
getVisibleItems(start, end)
Find all elements within the start and end range
If no element is found, returns an empty array
- Parameters:
- start
- time
- end
- time
- Returns:
- Array itemsInRange
initialItemsPosition(items, groupBase)
- Parameters:
- items
- groupBase
<static>
{Boolean}
links.Timeline.isArray(obj)
Check if given object is a Javascript Array
- Parameters:
- {*} obj
- Returns:
- {Boolean} isArray true if the given object is an array
{boolean}
isEditable(item)
Check whether a given item is editable
- Parameters:
- {links.Timeline.Item} item
- Returns:
- {boolean} editable
{boolean}
isSelected(index)
Check if an item is currently selected
- Parameters:
- {Number} index
- Returns:
- {boolean} true if row is selected, else false
<static>
{map}
links.Timeline.mapColumnIds(dataTable)
Retrieve a map with the column indexes of the columns by column name.
For example, the method returns the map
{
start: 0,
end: 1,
content: 2,
group: undefined,
className: undefined
editable: undefined
type: undefined
}
- Parameters:
- {google.visualization.DataTable} dataTable
move(moveFactor)
Move the timeline the given movefactor to the left or right. Start and end
date will be adjusted, and the timeline will be redrawn.
For example, try moveFactor = 0.1 or -0.1
- Parameters:
- {Number} moveFactor
- Moving amount. Positive value will move right, negative value will move left
onDblClick(event)
Double click event occurred for an item
- Parameters:
- {Event} event
onMouseDown(event)
Start a moving operation inside the provided parent element
- Parameters:
- {Event} event
- The event that occurred (required for retrieving the mouse position)
onMouseMove(event)
Perform moving operating.
This function activated from within the funcion links.Timeline.onMouseDown().
- Parameters:
- {Event} event
- Well, eehh, the event
onMouseUp(event)
Stop moving operating.
This function activated from within the funcion links.Timeline.onMouseDown().
- Parameters:
- {event} event
- The event
onMouseWheel(event)
Event handler for mouse wheel event, used to zoom the timeline
Code from http://adomas.org/javascript-mouse-wheel/
- Parameters:
- {Event} event
- The event
onTouchEnd(event)
Event handler for touchend event on mobile devices
- Parameters:
- event
onTouchMove(event)
Event handler for touchmove event on mobile devices
- Parameters:
- event
onTouchStart(event)
Event handler for touchstart event on mobile devices
- Parameters:
- event
<static>
{Date}
links.Timeline.parseJSONDate(date)
parse a JSON date
- Parameters:
- {Date | String | Number} date
- Date object to be parsed. Can be: - a Date object like new Date(), - a long like 1356970529389, an ISO String like "2012-12-31T16:16:07.213Z", or a .Net Date string like "\/Date(1356970529389)\/"
- Returns:
- {Date} parsedDate
<static>
links.Timeline.preventDefault(event)
Cancels the event if it is cancelable, without stopping further propagation of the event.
- Parameters:
- event
recalcConversion()
Calculate the factor and offset to convert a position on screen to the
corresponding date and vice versa.
After the method calcConversionFactor is executed once, the methods screenToTime and
timeToScreen can be used.
{boolean}
recalcItems()
Recalculate item properties:
- the height of each group.
- the actualHeight, from the stacked items or the sum of the group heights
- Returns:
- {boolean} resized returns true if any of the items properties is changed
redraw()
Redraw the timeline
Reloads the (linked) data table and redraws the timeline when resized.
See also the method checkResize
{boolean}
reflowAxis()
Reflow the timeline axis. Calculate its height, width, positioning, etc...
- Returns:
- {boolean} resized returns true if the axis is resized
{boolean}
reflowFrame()
Reflow the timeline frame
- Returns:
- {boolean} resized Returns true if any of the frame elements have been resized.
{boolean}
reflowGroups()
Reflow the size of the groups
- Returns:
- {boolean} resized Returns true if any of the frame elements have been resized.
{boolean}
reflowItems()
Reflow all items, retrieve their actual size
- Returns:
- {boolean} resized returns true if any of the items is resized
<static>
links.Timeline.removeClassName(elem, className)
Removes one or more className's from the given elements style
- Parameters:
- {Element} elem
- {String} className
<static>
links.Timeline.removeEventListener(element, action, listener, useCapture)
Remove an event listener from an element
- Parameters:
- {Element} element
- An html dom element
- {string} action
- The name of the event, for example "mousedown"
- {function} listener
- The listener function
- {boolean} useCapture
render(options)
Re-render (reflow and repaint) all components of the Timeline: frame, axis,
items, ...
- Parameters:
- {Object} options Optional
- Available options: {boolean} renderTimesLeft Number of times the render may be repeated 5 times by default. {boolean} animate takes options.animate as default value
{boolean}
repaint()
Repaint all components of the Timeline
- Returns:
- {boolean} needsReflow Returns true if the DOM is changed such that a reflow is needed.
{boolean}
repaintAxis()
Redraw the timeline axis with minor and major labels
- Returns:
- {boolean} needsReflow Returns true if the DOM is changed such that a reflow is needed.
{boolean}
repaintAxisCharacters()
Create characters used to determine the size of text on the axis
- Returns:
- {boolean} needsReflow Returns true if the DOM is changed such that a reflow is needed.
repaintAxisEndOverwriting()
End of overwriting HTML DOM elements of the axis.
remaining elements will be removed
repaintAxisHorizontal()
Repaint the horizontal line and background of the axis
repaintAxisMajorLine(x)
Create a Major line for the axis at position x
- Parameters:
- {Number} x
repaintAxisMajorText(x, text)
Create a Major label for the axis at position x
- Parameters:
- {Number} x
- {String} text
repaintAxisMinorLine(x)
Create a minor line for the axis at position x
- Parameters:
- {Number} x
repaintAxisMinorText(x, text)
Create a minor label for the axis at position x
- Parameters:
- {Number} x
- {String} text
repaintAxisStartOverwriting()
Initialize redraw of the axis. All existing labels and lines will be
overwritten and reused.
repaintCurrentTime()
Redraw the current time bar
repaintCustomTime()
Redraw the custom time bar
repaintDeleteButton()
Redraw the delete button, on the top right of the currently selected item
if there is no item selected, the button is hidden.
repaintDragAreas()
Redraw the drag areas. When an item (ranges only) is selected,
it gets a drag area on the left and right side, to change its width
{boolean}
repaintFrame()
repaint the Timeline frame
- Returns:
- {boolean} needsReflow Returns true if the DOM is changed such that a reflow is needed.
repaintGroups()
Redraw the group labels
{boolean}
repaintItems()
Repaint all items
- Returns:
- {boolean} needsReflow Returns true if the DOM is changed such that a reflow is needed.
repaintNavigation()
Create the navigation buttons for zooming and moving
{Date}
screenToTime(x)
Convert a position on screen (pixels) to a datetime
Before this method can be used, the method calcConversionFactor must be
executed once.
- Parameters:
- {int} x
- Position on the screen in pixels
- Returns:
- {Date} time The datetime the corresponds with given position x
selectCluster(index)
Select an cluster by its index
- Parameters:
- {Number} index
selectItem(index)
Select an item by its index
- Parameters:
- {Number} index
setAutoScale(enable)
Enable or disable autoscaling
- Parameters:
- {boolean} enable
- If true or not defined, autoscaling is enabled. If false, autoscaling is disabled.
setCurrentTime(time)
Set current time. This function can be used to set the time in the client
timeline equal with the time on a server.
- Parameters:
- {Date} time
setCustomTime(time)
Set custom time.
The custom time bar can be used to display events in past or future.
- Parameters:
- {Date} time
setData(data)
Set data for the timeline
- Parameters:
- {google.visualization.DataTable | Array} data
setOptions(options)
Set options for the timeline.
Timeline must be redrawn afterwards
- Parameters:
- {Object} options
- A name/value map containing settings for the timeline. Optional.
setScale(scale, step)
Set a custom scale. Autoscaling will be disabled.
For example setScale(SCALE.MINUTES, 5) will result
in minor steps of 5 minutes, and major steps of an hour.
- Parameters:
- {links.Timeline.StepDate.SCALE} scale
- A scale. Choose from SCALE.MILLISECOND, SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR, SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH, SCALE.YEAR.
- {int} step
- A step size, by default 1. Choose for example 1, 2, 5, or 10.
{boolean}
setSelection(selection)
Select an event. The visible chart range will be moved such that the selected
event is placed in the middle.
For example selection = [{row: 5}];
- Parameters:
- {Array} selection
- An array with a column row, containing the row number (the id) of the event to be selected.
- Returns:
- {boolean} true if selection is succesfully set, else false.
setSize(width, height)
Set a new size for the timeline
- Parameters:
- {string} width
- Width in pixels or percentage (for example "800px" or "50%")
- {string} height
- Height in pixels or percentage (for example "400px" or "30%")
setVisibleChartRange(start, end, redraw)
Set a new value for the visible range int the timeline.
Set start undefined to include everything from the earliest date to end.
Set end undefined to include everything from start to the last date.
Example usage:
myTimeline.setVisibleChartRange(new Date("2010-08-22"),
new Date("2010-09-13"));
- Parameters:
- {Date} start
- The start date for the timeline. optional
- {Date} end
- The end date for the timeline. optional
- {boolean} redraw
- Optional. If true (default) the Timeline is directly redrawn
setVisibleChartRangeAuto()
Change the visible chart range such that all items become visible
setVisibleChartRangeNow()
Adjust the visible range such that the current time is located in the center
of the timeline
{Object[]}
stackCalculateFinal(items)
Adjust vertical positions of the events such that they don't overlap each
other.
- Parameters:
- {timeline.Item[]} items
- Returns:
- {Object[]} finalItems
stackCancelAnimation()
Cancel any running animation
stackItems(animate)
Stack the items such that they don't overlap. The items will have a minimal
distance equal to options.eventMargin.
- Parameters:
- {boolean | undefined} animate
- if animate is true, the items are moved to their new position animated defaults to false.
{Object}
stackItemsCheckOverlap(items, itemIndex, itemStart, itemEnd)
Check if the destiny position of given item overlaps with any
of the other items from index itemStart to itemEnd.
- Parameters:
- {Array} items
- Array with items
- {int} itemIndex
- Number of the item to be checked for overlap
- {int} itemStart
- First item to be checked.
- {int} itemEnd
- Last item to be checked.
- Returns:
- {Object} colliding item, or undefined when no collisions
{boolean}
stackMoveOneStep(currentItems, finalItems)
Move the events one step in the direction of their final positions
- Parameters:
- {Array} currentItems
- Array with the real items and their current positions
- {Array} finalItems
- Array with objects containing the final positions of the items
- Returns:
- {boolean} arrived True if all items have reached their final location, else false
stackMoveToFinal(currentItems, finalItems)
Move the events from their current position to the final position
- Parameters:
- {Array} currentItems
- Array with the real items and their current positions
- {Array} finalItems
- Array with objects containing the final positions of the items
{Array}
stackOrder(items)
Order the items in the array this.items. The default order is determined via:
- Ranges go before boxes and dots.
- The item with the oldest start time goes first
If a custom function has been provided via the stackorder option, then this will be used.
- Parameters:
- {Array} items
- Array with items
- Returns:
- {Array} sortedItems Array with sorted items
<static>
links.Timeline.stopPropagation(event)
Stop event propagation
- Parameters:
- event
{int}
timeToScreen(time)
Convert a datetime (Date object) into a position on the screen
Before this method can be used, the method calcConversionFactor must be
executed once.
- Parameters:
- {Date} time
- A date
- Returns:
- {int} x The position on the screen in pixels which corresponds with the given date.
trigger(event)
fire an event
- Parameters:
- {String} event
- The name of an event, for example "rangechange" or "edit"
unselectItem()
Unselect the currently selected event (if any)
updateData(index, values)
Update the original data with changed start, end or group.
- Parameters:
- {Number} index
- {Object} values
- An object containing some of the following parameters: {Date} start, {Date} end, {String} content, {String} group
zoom(zoomFactor, zoomAroundDate)
Zoom the timeline the given zoomfactor in or out. Start and end date will
be adjusted, and the timeline will be redrawn. You can optionally give a
date around which to zoom.
For example, try zoomfactor = 0.1 or -0.1
- Parameters:
- {Number} zoomFactor
- Zooming amount. Positive value will zoom in, negative value will zoom out
- {Date} zoomAroundDate
- Date around which will be zoomed. Optional