ChartLineModel+LoopKitUI.swift 755 B

123456789101112131415161718192021222324
  1. //
  2. // ChartLineModel.swift
  3. // Loop
  4. //
  5. // Copyright © 2017 LoopKit Authors. All rights reserved.
  6. //
  7. import SwiftCharts
  8. extension ChartLineModel {
  9. /// Creates a model configured with the dashed prediction line style
  10. ///
  11. /// - Parameters:
  12. /// - points: The points to construct the line
  13. /// - color: The line color
  14. /// - width: The line width
  15. /// - Returns: A new line model
  16. static func predictionLine(points: [T], color: UIColor, width: CGFloat) -> ChartLineModel {
  17. // TODO: Bug in ChartPointsLineLayer requires a non-zero animation to draw the dash pattern
  18. return self.init(chartPoints: points, lineColor: color, lineWidth: width, animDuration: 0.0001, animDelay: 0, dashPattern: [6, 5])
  19. }
  20. }