DurationTimeIntervalLabelGenerator
public struct DurationTimeIntervalLabelGenerator : TimeLabelGenerator
Formats interval 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, separator: String? = 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 start label part 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 for start label parts (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?
-
Optional separator between start and finish parts of the label. If not specified, a dash is used as separator.
Declaration
Swift
public var separator: String?
-
Returns strings representing the durations passed between the reference time and the start and finish times of each interval, joining the results using the specified separator. Note that the finish time is internally decremented by a millisecond internally (before passing it to the duration computation) to obtain values that better represent the labeled interval.
Declaration
Swift
public func label(for time: TimeRange) -> String?