AxisValueFormatter.swift 894 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // AxisValueFormatter.swift
  3. // Charts
  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. /// An interface for providing custom axis Strings.
  13. @objc(ChartAxisValueFormatter)
  14. public protocol AxisValueFormatter: class
  15. {
  16. /// Called when a value from an axis is formatted before being drawn.
  17. ///
  18. /// For performance reasons, avoid excessive calculations and memory allocations inside this method.
  19. ///
  20. /// - Parameters:
  21. /// - value: the value that is currently being drawn
  22. /// - axis: the axis that the value belongs to
  23. /// - Returns: The customized label that is drawn on the x-axis.
  24. func stringForValue(_ value: Double,
  25. axis: AxisBase?) -> String
  26. }