Skip to content

PeriodSelector

Type class

PeriodSelector displays date input fields and predefined period buttons.

Sources

This information about PeriodSelector is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

PeriodSelector does not extend any other symbol.

PeriodSelector is not extended by any other symbol.

Properties

dateFormat

Type stringDefault DD-MM-YYYY

Date format of date input fields. Check this page for possible codes.

fromText

Type stringDefault From:

Text displayed next to "from" date input field.

hideOutOfScopePeriods

Type booleanDefault true

Specifies if period buttons with date range bigger than available data should be hidden.

inputFieldsEnabled

Type booleanDefault true

Specifies whether period selector displays "from" and "to" date input fields.

inputFieldWidth

Type numberDefault 100

Width of date input fields, in pixels. Works only if period selector is horizontal.

periods

Type arrayDefault

Array of predefined period objects. Period object has 4 properties - period, count, label and selected. Possible period values are: "ss" - seconds, "mm" - minutes, "hh" - hours, "DD" - days, "MM" - months and "YYYY" - years. property "count" specifies how many periods this button will select. "label" will be displayed on a button and "selected" is a boolean which specifies if this button is selected when chart is initialized or not. Example: {period:"DD", count:10, label:"10 days", selected:false}.

periodsText

Type stringDefault Zoom:

Text displayed next to predefined period buttons.

position

Type stringDefault bottom

Possible values: "right", "left", "top", "bottom".

selectFromStart

Type booleanDefault false

Specifies whether predefined period buttons should select a period from the beginning or the end of the data.

toText

Type stringDefault To:

Text displayed next to "to" date input field.

width

Type numberDefault 180

Width of a period selector, when position is "left" or "right".

Methods

addListener()

Returns void

type - string like 'changed' (listed in 'events' section of this class). handler - function which is called when event happens

removeListener()

Returns void

setDefaultPeriod()

Returns void

Resets the chart zoom to whatever default PeriodSelector button is. Can be used to simulate a click on period buttons buy changing "selected" property of PeriodSelector.periods items.

Events

changed

Param { type: "changed", target: PeriodSelector } & {type:"changed", startDate:Date, endDate:Date, predefinedPeriod:periodString, count:Number}

Dispatched when dates in period selector input fields are changed or user clicks on one of the predefined period buttons.