Skip to content

Period action

Use this action with change({ id: 'Period', context }).

Context

  • id?: Update | Delete (Update is assumed if omitted)
  • period: an ISO 8601 duration string (P[n]Y[n]M[n]DT[n]H[n]M[n]S) or "YTD"
  • range: { from, to } where both values are JavaScript timestamps (Date#getTime())
  • density: number (bar density)
  • period (for Delete): true

Behavior

Period supports:

  • Update: set exactly one of period, range, or density.
  • Delete: clear explicit period settings ({ id: 'Delete', period: true }).

If range is provided, the chart uses explicit from/to timestamps. "YTD" dynamically displays data from January 1 of the latest data point’s calendar year through that point. The latest data point, rather than the current date, determines the year, so historical charts and non-trading days remain stable. Concrete ISO durations are always treated literally and are never inferred to mean YTD. Setting period, range, or density resets zoom state.