LineRadarChartDataSet.swift 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // LineRadarChartDataSet.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. open class LineRadarChartDataSet: LineScatterCandleRadarChartDataSet, LineRadarChartDataSetProtocol
  14. {
  15. // MARK: - Data functions and accessors
  16. // MARK: - Styling functions and accessors
  17. /// The color that is used for filling the line surface area.
  18. private var _fillColor = NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0)
  19. /// The color that is used for filling the line surface area.
  20. open var fillColor: NSUIColor
  21. {
  22. get { return _fillColor }
  23. set
  24. {
  25. _fillColor = newValue
  26. fill = nil
  27. }
  28. }
  29. /// The object that is used for filling the area below the line.
  30. /// **default**: nil
  31. open var fill: Fill?
  32. /// The alpha value that is used for filling the line surface,
  33. /// **default**: 0.33
  34. open var fillAlpha = CGFloat(0.33)
  35. private var _lineWidth = CGFloat(1.0)
  36. /// line width of the chart (min = 0.0, max = 10)
  37. ///
  38. /// **default**: 1
  39. open var lineWidth: CGFloat
  40. {
  41. get
  42. {
  43. return _lineWidth
  44. }
  45. set
  46. {
  47. _lineWidth = newValue.clamped(to: 0...10)
  48. }
  49. }
  50. /// Set to `true` if the DataSet should be drawn filled (surface), and not just as a line.
  51. /// Disabling this will give great performance boost.
  52. /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers).
  53. open var drawFilledEnabled = false
  54. /// `true` if filled drawing is enabled, `false` ifnot
  55. open var isDrawFilledEnabled: Bool
  56. {
  57. return drawFilledEnabled
  58. }
  59. // MARK: NSCopying
  60. open override func copy(with zone: NSZone? = nil) -> Any
  61. {
  62. let copy = super.copy(with: zone) as! LineRadarChartDataSet
  63. copy.fill = fill
  64. copy.fillAlpha = fillAlpha
  65. copy._fillColor = _fillColor
  66. copy._lineWidth = _lineWidth
  67. copy.drawFilledEnabled = drawFilledEnabled
  68. return copy
  69. }
  70. }