Last updated

API / geotoolkit / axis / DateTimeTickGenerator / DateTimeTickGenerator

Class: DateTimeTickGenerator

axis.DateTimeTickGenerator.DateTimeTickGenerator

Define date and time tick generator. Ticks are generated based on UTC date and time by default if no timezone offset is specified

Hierarchy

Table of contents

Constructors
[new DateTimeTickGenerator(options)](/solutions/geotoolkit/apis/classes/geotoolkit.axis.datetimetickgenerator.datetimetickgenerator.md#new datetimetickgenerator(options))[new DateTimeTickGenerator(options, offsetUnit)](/solutions/geotoolkit/apis/classes/geotoolkit.axis.datetimetickgenerator.datetimetickgenerator.md#new datetimetickgenerator(options, offsetunit))
Methods
Css Properties
Name Type Description
labelmodeLabelModeLabel mode
labelstylesTextStyleAn object containing label style for specified grades
labelstyles-alignmentAlignmentStyleAlignment
labelstyles-autosizebooleanAuto font size on high definition display
labelstyles-backgroundstringBackground style
labelstyles-backgroundFillStyleBackground style
labelstyles-background-colorstringColor in CSS form
labelstyles-background-evenoddmodebooleanEven-odd fill mode
labelstyles-background-fillpatternPatternPattern
labelstyles-background-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
labelstyles-background-fillpattern-patternnamestringName of this pattern for indexing
labelstyles-background-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
labelstyles-background-foregroundstringForeground color
labelstyles-background-patternPatternPattern
labelstyles-baselineBaseLineStyleBase line
labelstyles-colorstringColor in CSS form
labelstyles-fillFillStyleText fill style
labelstyles-fontstringFont see
labelstyles-fonturlstringThe place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword
labelstyles-lineheightstring | numberLine height
labelstyles-multilinebooleanAllow multi-line text
labelstyles-outlinestringOutline style
labelstyles-outlineLineStyleOutline style
labelstyles-outline-colorstringColor in CSS form
labelstyles-outline-fillstringOptional fill style to be used to fill lines generated with this style
labelstyles-outline-fillFillStyleOptional fill style to be used to fill lines generated with this style
labelstyles-outline-linecapCapStyleThe line cap style
labelstyles-outline-linedashoffsetnumberLine dash offset of dashed line
labelstyles-outline-linejoinJoinStyleThe line join style
labelstyles-outline-pixelsnapmodebooleanPixel Snap Mode, default(
labelstyles-outline-scalablebooleanTrue if width should depend on transformation
labelstyles-outline-unitstringOptional unit for the width
labelstyles-outline-widthnumber | stringThe line thickness
labelstyles-overflowwrapOverflowWrapStyleOverflow wrap
labelstyles-strikethroughstringStrikethrough style
labelstyles-strikethroughLineStyleStrikethrough style
labelstyles-textoverflowTextOverflowStyleText overflow
labelstyles-underlinestringUnderline style
labelstyles-underlineLineStyleUnderline style
labelstyles-underlineoffsetstring | numberUnderline offset distance
labelstyles-whitespaceWhiteSpaceStyleWhite space
labelstyles-wordbreakWordBreakStyleWord break
localtimezoneoffsetnumberLocal time zone offset unit
rotatelabelsbooleanRotate labels or not
taganyTag user can specify info associated with current object
tickstylesLineStyleAn object containing tick styles for specified grades
timezoneTimeZoneTime zone UTC or Local Time
timezoneoffsetnumberUTC time if timeZoneOffset is 0
zoomlevelnumberZoom level

Contents

Constructors

new DateTimeTickGenerator(options)

new DateTimeTickGenerator(options?)

Parameters

Name Type Description
Optional optionsOptionsAn object containing the properties to set

Overrides

TickGenerator.constructor


new DateTimeTickGenerator(options, offsetUnit)

new DateTimeTickGenerator(options?, offsetUnit?)

Parameters

Name Type Description
Optional optionsnumbertimezoneoffset
Optional offsetUnitAbstractUnitoffset unit specified in sec,mls,hours.

Overrides

TickGenerator.constructor

Methods

clone

clone(): DateTimeTickGenerator

All subclasses should override copyConstructor or provide custom implementation for this method

Returns

DateTimeTickGenerator

clone

Overrides

TickGenerator.clone


connectStyle

connectStyle(style, type, callback): DateTimeTickGenerator

Connects style.

This convenience method subscribes a listener to given style for the specified type.
And automatically un-subscribes listener if node is disposed to prevent memory leaks

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

DateTimeTickGenerator

Inherited from

TickGenerator.connectStyle


copyConstructor

Protected copyConstructor(src, deepCopy?): DateTimeTickGenerator

Copy constructor

Parameters

Name Type Description
srcDateTimeTickGeneratorSource to copy from
Optional deepCopybooleandeep copy

Returns

DateTimeTickGenerator

this

Overrides

TickGenerator.copyConstructor


disconnectStyle

disconnectStyle(style, type, callback): DateTimeTickGenerator

Disconnect style

This convenience method un-subscribes a listener to given style for the specified type.

Parameters

Name Type Description
styleEventDispatcherconnect style
typestringtype of event or property
callbackAttributeCallback<EventDispatcher>function to be called

Returns

DateTimeTickGenerator

Inherited from

TickGenerator.disconnectStyle


dispose

dispose(): void

Disposes this node, once disposes a node should not be used anymore.
Clear all listeners, and disconnect styles to avoid memory leaks.
Also aggressively 'cleanup' this node by setting some of its members to null.

Returns

void

Inherited from

TickGenerator.dispose


execute

execute(delegate): DateTimeTickGenerator

Executes delegate and returns the result

Parameters

Name Type Description
delegate(this: DateTimeTickGenerator) => voidexecute delegate and return the result

Returns

DateTimeTickGenerator

Inherited from

TickGenerator.execute

execute<T>(delegate): T

Type parameters

Name
T

Parameters

Name Type
delegate(this: DateTimeTickGenerator) => T

Returns

T

Inherited from

TickGenerator.execute


formatLabel

formatLabel(parent, orient, tickInfo, tickIndex, modelValue): string

Formats label text. This method must be overridden in the base classes and the the base class method must be called first.

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfoan info about tick
tickIndexnumbertickIndex tick index from 0 to count-1, which resetLabels returns
modelValuenumbermodel value

Returns

string

formatted label text

Inherited from

TickGenerator.formatLabel


getAdjustLabelAnchor

getAdjustLabelAnchor(grade): boolean

Gets adjust label anchor flag for specified label grade

Parameters

Name Type Description
gradestringlabel grade

Returns

boolean

label anchor flag ("true" by default for any grade)

Inherited from

TickGenerator.getAdjustLabelAnchor


getBoundingBox

getBoundingBox(tickInfo, orient, labelPos, labelText?): Rect

Returns bounding box of label

Parameters

Name Type Description
tickInfoTickInfoinfo about the tick
orientOrientationorientation
labelPosnumberlabel position along index direction
Optional labelTextstringlabel text. If not defined labelPos.toString() is used.

Returns

Rect

bbox bounding box

Inherited from

TickGenerator.getBoundingBox


getClassName

getClassName(): string

Returns

string

Inherited from

TickGenerator.getClassName


getFormatLabelHandler

getFormatLabelHandler(): LabelFormatHandler

Returns label format handler

Returns

LabelFormatHandler

Inherited from

TickGenerator.getFormatLabelHandler


getGrades

getGrades(): string[]

Returns valid Tick string : "edge", "major", "intermediate", "minor"

Returns

string[]

array of known Tick string

Inherited from

TickGenerator.getGrades


getInvalidateMethod

Protected getInvalidateMethod(): AttributeCallback<EventDispatcher>

invalidate Method

Returns

AttributeCallback<EventDispatcher>

method to invalidate this object

Inherited from

TickGenerator.getInvalidateMethod


getLabelAnchorType

getLabelAnchorType(grade, transformation?): AnchorType

Gets label anchor type

Parameters

Name Type Description
gradestringtick grade
Optional transformationTransformationoptional transformation from model to device. It is used only for custom label anchor handler

Returns

AnchorType

Inherited from

TickGenerator.getLabelAnchorType


getLabelMode

getLabelMode(): LabelMode

Gets label mode

Returns

LabelMode


getLabelRotationAngle

getLabelRotationAngle(tickGrade): number

Returns label rotation angle

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types

Returns

number

label rotation angle

Inherited from

TickGenerator.getLabelRotationAngle


getLabelStyle

getLabelStyle(tickGrade): TextStyle

Returns label style

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types

Returns

TextStyle

label style

Inherited from

TickGenerator.getLabelStyle


getLabelValueTransformer

getLabelValueTransformer(): ValueTransformer | (modelValue: number) => number

Gets label value transformer (by default: 'undefined' - no transformation is applied to a value)

Returns

ValueTransformer | (modelValue: number) => number

transformer label value transformer

Inherited from

TickGenerator.getLabelValueTransformer


getMaxLabelMetrics

getMaxLabelMetrics(parent, orientation, tickInfo, fromValue, toValue): Dimension

Returns maximum label metrics. For internal use only

Parameters

Name Type Description
parentIModelparent axis or grid
orientationOrientationorientation
tickInfoTickInfoinfo about tick position
fromValuenumbergenerate labels from
toValuenumbergenerate labels to

Returns

Dimension

Inherited from

TickGenerator.getMaxLabelMetrics


getMaxLabels

Protected getMaxLabels(tickInfo, orient, fromValue, toValue): { type: string ; value: number }[]

Returns max labels for each type of grades

Parameters

Name Type Description
tickInfoTickInfoinfo about the tick
orientOrientationorientation
fromValuenumbergenerate labels from
toValuenumbergenerate labels to

Returns

{ type: string ; value: number }[]

Overrides

TickGenerator.getMaxLabels


getNeatLimits

getNeatLimits(min, max, options): Limits

Return nice limits, default implementation is for linear model space

Parameters

Name Type
minnumber
maxnumber
optionsObject
Optional options.preciseboolean
options.sizenumber
options.spannumber

Returns

Limits

Inherited from

TickGenerator.getNeatLimits


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

properties

Overrides

TickGenerator.getProperties


getTag

getTag(): any

Returns tag

Returns

any

the tag

Inherited from

TickGenerator.getTag


getTickSize

getTickSize(grade): number

Returns the size of specified tick

Parameters

Name Type Description
gradestringGrade of the tick to get the size see TickGenerator.getGrades for valid Tick types

Returns

number

Inherited from

TickGenerator.getTickSize


getTickStyle

getTickStyle(tickGrade): LineStyle

Returns tick style

Parameters

Name Type Description
tickGradestringTick Grade see TickGenerator.getGrades for valid Tick types

Returns

LineStyle

line style

Inherited from

TickGenerator.getTickStyle


getTimeZone

getTimeZone(): TimeZone

Get time zone

Returns

TimeZone

timeZone


getVisibleLabelGrades

getVisibleLabelGrades(supported): string[]

Return an array of the visible label grades

Parameters

Name Type Description
supportedstring[]supported grades see TickGenerator.getGrades for valid Tick types

Returns

string[]

the visible grades

Inherited from

TickGenerator.getVisibleLabelGrades


getVisibleTickGrades

getVisibleTickGrades(supported): string[]

Returns an array of the visible tick grades

Parameters

Name Type Description
supportedstring[]supported grades see TickGenerator.getGrades for valid Tick types

Returns

string[]

the visible grades

Inherited from

TickGenerator.getVisibleTickGrades


getZoomLevel

getZoomLevel(): number

Gets zoom level

Returns

number


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

TickGenerator.hasEventListener


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

TickGenerator.isDisposed


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

TickGenerator.isSilent


isValid

isValid(parent, orient, tickInfo): boolean

Verify tick generator parameters to have better label distribution

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfotick info

Returns

boolean

true if no label intersection

Inherited from

TickGenerator.isValid


isVisibleLabelGrade

isVisibleLabelGrade(tickGrade): boolean

Returns visibility of label for a specific tick grade

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types

Returns

boolean

true if label is visible

Inherited from

TickGenerator.isVisibleLabelGrade


isVisibleTickGrade

isVisibleTickGrade(tickGrade): boolean

Returns visibility of tick for a specific tick grade

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types

Returns

boolean

true if the tick is visible

Inherited from

TickGenerator.isVisibleTickGrade


nextLabel

nextLabel(parent, orient, tickInfo, tickIndex): number

Generates information about next label

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfoinfo about tick
tickIndexnumbertickIndex tick index from 0 to count-1, which resetLabels returns

Returns

number

the model position of the label

Inherited from

TickGenerator.nextLabel


nextTick

nextTick(parent, orient, tickInfo, tickIndex): number

Generates information about next tick

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfoinfo about tick
tickIndexnumbertick index from 0 to count-1, which resetTicks returns

Returns

number

the model position of the tick

Inherited from

TickGenerator.nextTick


notify

notify<E>(type, source, args?): DateTimeTickGenerator

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceTickGeneratorof the event
Optional argsEventMap[E]arguments of the event

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.notify


off

off<E>(type?, callback?): DateTimeTickGenerator

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: DateTimeTickGenerator, args: EventMap[E]) => voidfunction to be called

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.off


on

on<E>(type, callback): DateTimeTickGenerator

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: DateTimeTickGenerator, args: EventMap[E]) => voidto be called

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.on


reset

reset(parent, orient, tickInfo): string[]

Resets tick generator

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfotick info

Returns

string[]

a supported tick grade list

Inherited from

TickGenerator.reset


resetAsync

resetAsync(parent, orient, tickInfo, callback): void

Resets tick generator asynchronously

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfotick info
callback(x: string[]) => voidcalls when asynchronous reset is done

Returns

void

Inherited from

TickGenerator.resetAsync


resetLabels

resetLabels(parent, orient, tickInfo): number

Reset labels. This method is called to start iteration by labels. The implementation also sets appropriate TextStyle on labels.

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfoan info about labels. This information is used to pass and receive information about the current tick or label

Returns

number

labels count for the current tick type

Inherited from

TickGenerator.resetLabels


resetMaxLabels

resetMaxLabels(): DateTimeTickGenerator

Reset max label info

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.resetMaxLabels


resetTicks

resetTicks(parent, orient, tickInfo): number

Resets ticks. This method is called to start iteration by ticks. The implementation also sets appropriate LineStyle on the ticks as well as their tick size.

Parameters

Name Type Description
parentIModelparent axis or grid
orientOrientationorientation
tickInfoTickInfoan info about labels. This information is used to pass and receive information about the current tick or label

Returns

number

ticks count for the current tick type. The implementation returns 0 if the ticks can not be drawn; a positive number otherwise.

Inherited from

TickGenerator.resetTicks


setAdjustLabelAnchor

setAdjustLabelAnchor(grade, flag): DateTimeTickGenerator

Sets adjust label anchor flag for specified label grade

Parameters

Name Type Description
gradestringlabel grade
flagbooleanadjust label anchor flag

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setAdjustLabelAnchor


setFormatLabelHandler

setFormatLabelHandler(handler): DateTimeTickGenerator

Sets label format handler

Parameters

Name Type Description
handlerLabelFormatHandlerhandler

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setFormatLabelHandler


setLabelAnchorType

setLabelAnchorType(grade, anchorType): DateTimeTickGenerator

Sets label anchor type

Parameters

Name Type Description
gradestringtick grade
anchorTypeAnchorType | AnchorStyleHandleranchorType

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setLabelAnchorType


setLabelMode

setLabelMode(mode): DateTimeTickGenerator

Sets label mode

Parameters

Name Type Description
modeLabelModelabel mode

Returns

DateTimeTickGenerator

this


setLabelRotationAngle

setLabelRotationAngle(tickGrade, angle): DateTimeTickGenerator

Sets label rotation angle

Example

// user can customize the label rotation angle based on tick grade.
tickGenerator.setLabelRotationAngle('major', -Math.PI / 2);

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types
anglenumberlabel rotation angle, in radians

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setLabelRotationAngle


setLabelStyle

setLabelStyle(tickGrade, labelStyle?, merge?): DateTimeTickGenerator

Sets label style

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types
Optional labelStyleTypetick text style
Optional mergebooleantrue if you want to merge labelStyle with existing attribute, false by default

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setLabelStyle


setLabelValueTransformer

setLabelValueTransformer(transformer): DateTimeTickGenerator

Sets label value transformer (optional)

Parameters

Name Type Description
transformerValueTransformer | (modelValue: number) => numberlabel value transformer

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setLabelValueTransformer


setProperties

setProperties(properties?): DateTimeTickGenerator

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

DateTimeTickGenerator

Overrides

TickGenerator.setProperties


setSilent

setSilent(bool): DateTimeTickGenerator

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setSilent


setTag

setTag(tag): DateTimeTickGenerator

Sets tag

Parameters

Name Type Description
taganyuser can specify info associated with current object

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setTag


setTickOptions

setTickOptions(properties?, tickGrade?): DateTimeTickGenerator

Sets all the properties pertaining to this tick

Parameters

Name Type Description
Optional propertiesRecord<string, TickOptions>An object containing the properties to set
Optional tickGradestringTick grade

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setTickOptions


setTickSize

setTickSize(grade, size): DateTimeTickGenerator

Changes the size of specified ticks

Parameters

Name Type Description
gradestringGrade of the tick to set the size see TickGenerator.getGrades for valid Tick types
sizenumberNew size

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setTickSize


setTickStyle

setTickStyle(tickGrade, lineStyle?, merge?): DateTimeTickGenerator

Sets tick style

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types
Optional lineStyleTypeline style for the tick
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setTickStyle


setTimeZone

setTimeZone(timeZone): DateTimeTickGenerator

Set time zone

Parameters

Name Type Description
timeZoneTimeZonetime zone UTC or Local Time

Returns

DateTimeTickGenerator

this


setTimeZoneOffset

setTimeZoneOffset(timeZoneOffset, offsetUnit?): DateTimeTickGenerator

Set time zone offset

Parameters

Name Type Description
timeZoneOffsetnumberUTC time if timeZoneOffset is 0
Optional offsetUnitstring | AbstractUnitspecified in sec,mls,hours.

Returns

DateTimeTickGenerator

this


setUnit

setUnit(unit): DateTimeTickGenerator

Sets unit

Parameters

Name Type Description
unitstring | AbstractUnitunit to be set

Returns

DateTimeTickGenerator

this


setVisibleLabelGrade

setVisibleLabelGrade(tickGrade, visible): DateTimeTickGenerator

Sets visibility of label for a specific tick grade Implementation of the reset should check visibility of the labels.

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types
visiblebooleantick label visibility flag

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setVisibleLabelGrade


setVisibleTickGrade

setVisibleTickGrade(tickGrade, visible): DateTimeTickGenerator

Sets visibility of tick for a specific tick grade Implementation of the reset should check visibility of the ticks

Parameters

Name Type Description
tickGradestringTick grade see TickGenerator.getGrades for valid Tick types
visiblebooleantick grade visibility flag

Returns

DateTimeTickGenerator

this

Inherited from

TickGenerator.setVisibleTickGrade


setZoomLevel

setZoomLevel(zoomLevel): DateTimeTickGenerator

Sets zoom level

Parameters

Name Type Description
zoomLevelnumberDate ZoomLevel

Returns

DateTimeTickGenerator

this


getClassName

Static getClassName(): string

Returns

string

Inherited from

TickGenerator.getClassName


setWeekStartMonday

Static setWeekStartMonday(enable): void

Enables week starting from Monday

Parameters

Name Type Description
enablebooleanEnables or disables week starting from Monday

Returns

void