LegendEntry.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // LegendEntry.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. import CoreGraphics
  13. @objc(ChartLegendEntry)
  14. open class LegendEntry: NSObject
  15. {
  16. public override init()
  17. {
  18. super.init()
  19. }
  20. /// - Parameters:
  21. /// - label: The legend entry text.
  22. /// A `nil` label will start a group.
  23. @objc public init(label: String?)
  24. {
  25. self.label = label
  26. }
  27. /// The legend entry text.
  28. /// A `nil` label will start a group.
  29. @objc open var label: String?
  30. /// The color for drawing the label
  31. @objc open var labelColor: NSUIColor?
  32. /// The form to draw for this entry.
  33. ///
  34. /// `None` will avoid drawing a form, and any related space.
  35. /// `Empty` will avoid drawing a form, but keep its space.
  36. /// `Default` will use the Legend's default.
  37. @objc open var form: Legend.Form = .default
  38. /// Form size will be considered except for when .None is used
  39. ///
  40. /// Set as NaN to use the legend's default
  41. @objc open var formSize: CGFloat = CGFloat.nan
  42. /// Line width used for shapes that consist of lines.
  43. ///
  44. /// Set to NaN to use the legend's default.
  45. @objc open var formLineWidth: CGFloat = CGFloat.nan
  46. /// Line dash configuration for shapes that consist of lines.
  47. ///
  48. /// This is how much (in pixels) into the dash pattern are we starting from.
  49. ///
  50. /// Set to NaN to use the legend's default.
  51. @objc open var formLineDashPhase: CGFloat = 0.0
  52. /// Line dash configuration for shapes that consist of lines.
  53. ///
  54. /// This is the actual dash pattern.
  55. /// I.e. [2, 3] will paint [-- -- ]
  56. /// [1, 3, 4, 2] will paint [- ---- - ---- ]
  57. ///
  58. /// Set to nil to use the legend's default.
  59. @objc open var formLineDashLengths: [CGFloat]?
  60. /// The color for drawing the form
  61. @objc open var formColor: NSUIColor?
  62. }