RadarMarkerView.swift 739 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // RadarMarkerView.swift
  3. // ChartsDemo
  4. //
  5. // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda
  6. // A port of MPAndroidChart for iOS
  7. // Licensed under Apache License 2.0
  8. //
  9. // https://github.com/danielgindi/Charts
  10. //
  11. import Foundation
  12. import DGCharts
  13. #if canImport(UIKit)
  14. import UIKit
  15. #endif
  16. public class RadarMarkerView: MarkerView {
  17. @IBOutlet var label: UILabel!
  18. public override func awakeFromNib() {
  19. self.offset.x = -self.frame.size.width / 2.0
  20. self.offset.y = -self.frame.size.height - 7.0
  21. }
  22. public override func refreshContent(entry: ChartDataEntry, highlight: Highlight) {
  23. label.text = String.init(format: "%d %%", Int(round(entry.y)))
  24. layoutIfNeeded()
  25. }
  26. }