Class links.Timeline.StepDate
Defined in: timeline.js.
Constructor Attributes | Constructor Name and Description |
---|---|
links.Timeline.StepDate(start, end, minimumStep)
|
Method Attributes | Method Name and Description |
---|---|
addZeros(value, len)
Add leading zeros to the given value to match the desired length.
|
|
end()
Check if the end date is reached
|
|
Get the current datetime
|
|
getLabelMajor(options, date)
Returns formatted text for the major axislabel, depending on the current
date and the scale.
|
|
getLabelMinor(options, date)
Returns formatted text for the minor axislabel, depending on the current
date and the scale.
|
|
isMajor()
Check if the current step is a major step (for example when the step
is DAY, a major step is each first day of the MONTH)
|
|
next()
Do the next step
|
|
Round the current date to the first minor date value
This must be executed once when the current date is set to start Date
|
|
setAutoScale(enable)
Enable or disable autoscaling
|
|
setMinimumStep(minimumStep)
Automatically determine the scale that bests fits the provided minimum step
|
|
setRange(start, end, minimumStep)
Set a new range
If minimumStep is provided, the step size is chosen as close as possible
to the minimumStep but larger than minimumStep.
|
|
setScale(newScale, newStep)
Set a custom scale.
|
|
snap(date)
Snap a date to a rounded value.
|
|
start()
Set the step iterator to the start date.
|
Class Detail
links.Timeline.StepDate(start, end, minimumStep)
- Parameters:
- {Date} start
- The start date, for example new Date(2010, 9, 21) or new Date(2010, 9, 21, 23, 45, 00)
- {Date} end
- The end date
- {Number} minimumStep
- Optional. Minimum step size in milliseconds
Method Detail
{string}
addZeros(value, len)
Add leading zeros to the given value to match the desired length.
For example addZeros(123, 5) returns "00123"
- Parameters:
- {int} value
- A value
- {int} len
- Desired final length
- Returns:
- {string} value with leading zeros
{boolean}
end()
Check if the end date is reached
- Returns:
- {boolean} true if the current date has passed the end date
{Date}
getCurrent()
Get the current datetime
- Returns:
- {Date} current The current date
getLabelMajor(options, date)
Returns formatted text for the major axislabel, depending on the current
date and the scale. For example when scale is MINUTE, the major scale is
hours, and the hour will be formatted as "hh".
- Parameters:
- {Object} options
- {Date} date Optional
- custom date. if not provided, current date is taken
getLabelMinor(options, date)
Returns formatted text for the minor axislabel, depending on the current
date and the scale. For example when scale is MINUTE, the current time is
formatted as "hh:mm".
- Parameters:
- {Object} options
- {Date} date Optional
- custom date. if not provided, current date is taken
{boolean}
isMajor()
Check if the current step is a major step (for example when the step
is DAY, a major step is each first day of the MONTH)
- Returns:
- {boolean} true if current date is major, else false.
next()
Do the next step
roundToMinor()
Round the current date to the first minor date value
This must be executed once when the current date is set to start Date
setAutoScale(enable)
Enable or disable autoscaling
- Parameters:
- {boolean} enable
- If true, autoascaling is set true
setMinimumStep(minimumStep)
Automatically determine the scale that bests fits the provided minimum step
- Parameters:
- {Number} minimumStep
- The minimum step size in milliseconds
setRange(start, end, minimumStep)
Set a new range
If minimumStep is provided, the step size is chosen as close as possible
to the minimumStep but larger than minimumStep. If minimumStep is not
provided, the scale is set to 1 DAY.
The minimumStep should correspond with the onscreen size of about 6 characters
- Parameters:
- {Date} start
- The start date and time.
- {Date} end
- The end date and time.
- {int} minimumStep
- Optional. Minimum step size in milliseconds
setScale(newScale, newStep)
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} newScale
- A scale. Choose from SCALE.MILLISECOND, SCALE.SECOND, SCALE.MINUTE, SCALE.HOUR, SCALE.WEEKDAY, SCALE.DAY, SCALE.MONTH, SCALE.YEAR.
- {Number} newStep
- A step size, by default 1. Choose for example 1, 2, 5, or 10.
snap(date)
Snap a date to a rounded value. The snap intervals are dependent on the
current scale and step.
- Parameters:
- {Date} date
- the date to be snapped
start()
Set the step iterator to the start date.