DurationTimeLabelGenerator

public struct DurationTimeLabelGenerator : TimeLabelGenerator

Formats time labels as duration values.

  • Undocumented

    Declaration

    Swift

    public init(reference: Time? = nil, in unit: TimeUnit? = nil,
                schedule: ScheduleDefinition? = nil,
                zeroBased: Bool? = nil, includingNegativeValues: Bool? = nil)
  • Reference time to use.

    Declaration

    Swift

    public var reference: Time?
  • Time unit to consider for computing duration numbers.

    Declaration

    Swift

    public var unit: TimeUnit?
  • Schedule to consider when computing duration (by default the continuous schedule is used). Note that no labels are returned for intervals that would otherwise share the same label with following ones (such as on weekend days when the standard schedule is used).

    Declaration

    Swift

    public var schedule: ScheduleDefinition?
  • Whether or not to return zero-based duration values (by default one-based).

    Declaration

    Swift

    public var zeroBased: Bool?
  • Whether or not to return negative duration values as well (by default only zero and positive duration values are returned as numeric labels).

    Declaration

    Swift

    public var includingNegativeValues: Bool?
  • Returns strings representing the durations passed between the reference time and the start time of each interval.

    Declaration

    Swift

    public func label(for time: TimeRange) -> String?