ChartLineModel+LoopKitUI.swift 767 B

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