Options
All
  • Public
  • Public/Protected
  • All
Menu

The timeline model stores the most important properties related to navigating within time (move forward and backward in time, zoom in and out).

Now - the "current" time (e.g. system time). Start time - the first time point that will be visible to the user. Millis per pixel - how much time is represented by a single pixel (important for zooming). Horizon - the earliest and latest point in time to which the user can scroll. Lowest temporal unit - the lowest unit that the user will be able to see (e.g. MINUTES). Highest temporal unit - the highest unit that the user will be able to see (e.g. MONTHS).

This class is also responsible for calculating the location for a given time and vice versa.

Type parameters

  • T: TemporalUnit

    the temporal unit supported by the model (e.g. ChronoUnit).

Hierarchy

Index

Properties

timeLineModelChangeProcessHolder

timeLineModelChangeProcessHolder: ProcessHolder = new ProcessHolder(() => this._timelineModelChangeES.next())

Methods

calculateLocationForTime

  • calculateLocationForTime(time: number): number
  • Returns the pixel location of the given time.

    Parameters

    • time: number

      the time for which to return the pixel location

    Returns number

    the location of the given time

calculateTimeForLocation

  • calculateTimeForLocation(location: number): number
  • Returns the time for the given location.

    Parameters

    • location: number

      the location in pixels

    Returns number

    the location time

getHorizonEndTime

  • getHorizonEndTime(): number
  • Returns the end time of the horizon.

    Returns number

    the horizon end time

getHorizonStartTime

  • getHorizonStartTime(): number
  • Returns the start time of the horizon.

    Returns number

    the horizon start time

getMaximumMillisPerPixel

  • getMaximumMillisPerPixel(): number
  • Returns the maximum number of milliseconds that will be represented by a single pixel on the screen. Zoom-Out operations will be limited by this value.

    since

    1.0

    Returns number

    the maximum MPP value

getMillisPerPixel

  • getMillisPerPixel(): number
  • Returns the millis per pixel value. This value determines how much time is represented by a single pixel in the user interface. Changing the value of this property will cause the control to show more or less time within the visible timeline area, meaning zooming can be controlled by this value.

    Returns number

getMinimumMillisPerPixel

  • getMinimumMillisPerPixel(): number
  • Returns the minimum number of milliseconds that will be represented by a single pixel on the screen. Zoom-In operations will be limited by this value.

    since

    1.0

    Returns number

    the minimum MPP value

getNow

  • getNow(): number
  • Returns "now", the current time, e.g. the current system time.

    Returns number

    the "now" time

getNowLocation

  • getNowLocation(): number
  • Returns the location of the "now" time. The location can be computed based on the millis per pixel and the start time value.

    Returns number

    the pixel location of "now"

getSmallestTemporalUnit

  • getSmallestTemporalUnit(): T
  • Returns the smallest temporal unit supported by the gantt.

    Returns T

    the smallest temporal unit

getStartTime

  • getStartTime(): number
  • Returns the first visible time point.

    Returns number

    the start time

getTimelineModelChangeObs

  • Gets an observable that will be triggered each time there is a modification of the timeline.

    Returns Observable<TimelineModel<T>>

requestToRedrawTimeline

  • requestToRedrawTimeline(): void
  • Method to call when we want to redraw the timeline

    Returns void

setHorizonEndTime

  • setHorizonEndTime(time: number): void
  • Sets the value of horizonEndTimeProperty().

    Parameters

    • time: number

      the horizon end time

    Returns void

setHorizonStartTime

  • setHorizonStartTime(time: number): void
  • Sets the start time of the horizon.

    Parameters

    • time: number

      the horizon start time

    Returns void

setMaximumMillisPerPixel

  • setMaximumMillisPerPixel(max: number): void
  • Sets the maximum MPP value.

    since

    1.0

    see

    setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)

    Parameters

    • max: number

      the maximum MPP value

    Returns void

setMillisPerPixel

  • setMillisPerPixel(millis: number): void
  • Sets the millis represented by a pixel().

    Parameters

    • millis: number

      the millis represented by a pixel

    Returns void

setMinimumMillisPerPixel

  • setMinimumMillisPerPixel(min: number): void
  • Sets the minimum MPP value.

    since

    1.0

    see

    setZoomRange(TemporalUnit, int, double, TemporalUnit, int, double)

    Parameters

    • min: number

      the minimum MPP value

    Returns void

setNow

  • setNow(now: number): void
  • Sets "now", the current time, e.g. the current system time.

    Parameters

    • now: number

      the "now" time

    Returns void

setStartTime

  • setStartTime(newTime: number): void
  • Sets the first visible time point.

    Parameters

    • newTime: number

      the start time

    Returns void

setStartTimeAndMillisPerPixel

  • setStartTimeAndMillisPerPixel(newTime: number, millis: number): void
  • Sets the first visible time point and the millis represented by a pixel() holding time line model change process holder.

    see

    setStartTime(newTime), setMillisPerPixel(millis)

    Parameters

    • newTime: number

      the start time

    • millis: number

      the millis represented by a pixel

    Returns void

setZoomRange

  • setZoomRange(smallestUnit: T, smallestUnitCount: number, smallestUnitWidth: number, largestUnit: T, largestUnitCount: number, largestUnitWidth: number): void
  • Sets the range in which the user can zoom in and out of the timeline.

    since

    1.0

    see

    ``setMinimumMillisPerPixel(double),setMaximumMillisPerPixel(double)```

    Parameters

    • smallestUnit: T

      the smallest unit to which the user can zoom (e.g. "MINUTES")

    • smallestUnitCount: number

      the number of smallest units (e.g. "5" MINUTES)

    • smallestUnitWidth: number

      the width of the unit in pixels, must be larger than 10 (e.g. "30")

    • largestUnit: T

      the largest unit to which the user can zoom (e.g. "YEARS")

    • largestUnitCount: number

      the number of largest units (e.g. "1" YEAR)

    • largestUnitWidth: number

      the width of the unit in pixels, must be larger than 10 (e.g. "30")

    Returns void

Static computeMillisPerPixel

  • computeMillisPerPixel(targetPixelsCount: number, durationUnit?: ChronoUnit, durationScalar?: number): number
  • Computes the millis per pixel for a given target pixels count and its corresponding duration.

    since

    1.0

    Parameters

    • targetPixelsCount: number
    • Default value durationUnit: ChronoUnit = ChronoUnit.DAYS
    • Default value durationScalar: number = 1

    Returns number