API Reference
Namespaces
Classes
Events
Global
Externals

Class: DateSegment

CIQ.ReferenceData. DateSegment ()

A helper class for updating the chart position/periodicity to match added Reference Data


new DateSegment()

Since:
  • 10.3.0

Methods


getFormattedStartDateDifference(dateA, dateB)

Returns a formatted string showing the difference between two dates with appropriate time unit. The result shows the signed difference (e.g., "-30 minutes", "+6 months") using the most appropriate time unit for the magnitude of the difference.

Parameters:
Name Type Description
dateA Date

The first date for comparison

dateB Date

The second date for comparison

Since:
  • 10.3.0

Returns:

Formatted string showing the signed difference with time unit

Type
string

getFormattedStartDateDifference(date)

Returns a formatted string showing the difference between the provided date and the chart's visible start date. The result is a human-readable string with the signed difference and appropriate time unit (e.g., "-30 minutes", "+6 months").

Parameters:
Name Type Description
date Date

The date to compare against the chart's visible start date

See:
  • getVisibleDateRange
  • getFormattedDateDifference
Returns:

Formatted string showing the signed difference with time unit

Type
string

getNearestPeriodicity()

Returns a Periodicity object that best matches the periodicity of the added dataset

Since:
  • 10.3.0

Returns:

Periodicity object

Type
CIQ.ChartEngine~PeriodicityParameters

getNearestStartDate(panAmount)

Internally finds an item whose date is nearest to the start date or end date of the chart.

Returns a start date, which, when applied to the chart via CIQ.ChartEngine#setStartDate, ensures that the nearest item is at least panAmount from the nearest chart start or end boundary.

Parameters:
Name Type Description
panAmount number

Value between 0 and 1 that represents where the nearest dataset date should appear on the chart (0 = at start, 1 = at end, 0.5 = in center)

Since:
  • 10.3.0

Returns:

Start date

Type
Date

getStartDateDifference(date)

Returns the absolute difference in milliseconds between the provided date and the chart's visible start date. This is useful for comparing temporal distances when a numeric value is needed rather than a formatted string.

Parameters:
Name Type Description
date Date

The date to compare against the chart's visible start date

Since:
  • 10.3.0

See:
  • getVisibleDateRange
  • getDateDistance
Returns:

The absolute difference in milliseconds

Type
number

getVisibility()

Returns a number between 0 and 1 representing the percentage of visible items in the added dataset

Since:
  • 10.3.0

Returns:

Percent visible

Type
number