Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing properties to copy(with:) methods #3715

Merged
merged 2 commits into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Source/Charts/Data/Implementations/ChartBaseDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Foundation
import CoreGraphics


open class ChartBaseDataSet: NSObject, IChartDataSet
open class ChartBaseDataSet: NSObject, IChartDataSet, NSCopying
{
public required override init()
{
Expand Down Expand Up @@ -411,13 +411,26 @@ open class ChartBaseDataSet: NSObject, IChartDataSet

// MARK: - NSCopying

@objc open func copyWithZone(_ zone: NSZone?) -> AnyObject
open func copy(with zone: NSZone? = nil) -> Any
{
let copy = type(of: self).init()

copy.colors = colors
copy.valueColors = valueColors
copy.label = label
copy.axisDependency = axisDependency
copy.highlightEnabled = highlightEnabled
copy._valueFormatter = _valueFormatter
copy.valueFont = valueFont
copy.form = form
copy.formSize = formSize
copy.formLineWidth = formLineWidth
copy.formLineDashPhase = formLineDashPhase
copy.formLineDashLengths = formLineDashLengths
copy.drawValuesEnabled = drawValuesEnabled
copy.drawValuesEnabled = drawValuesEnabled
copy.iconsOffset = iconsOffset
copy.visible = visible

return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,13 @@ open class BarChartDataEntry: ChartDataEntry

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! BarChartDataEntry
let copy = super.copy(with: zone) as! BarChartDataEntry
copy._yVals = _yVals
copy.y = y
copy._negativeSum = _negativeSum
copy._positiveSum = _positiveSum
return copy
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,16 @@ open class BarChartDataSet: BarLineScatterCandleBubbleChartDataSet, IBarChartDat

// MARK: - NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! BarChartDataSet
let copy = super.copy(with: zone) as! BarChartDataSet
copy._stackSize = _stackSize
copy._entryCountStacks = _entryCountStacks
copy.stackLabels = stackLabels

copy.barShadowColor = barShadowColor
copy.barBorderWidth = barBorderWidth
copy.barBorderColor = barBorderColor
copy.highlightAlpha = highlightAlpha
return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ open class BarLineScatterCandleBubbleChartDataSet: ChartDataSet, IBarLineScatter

// MARK: - NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! BarLineScatterCandleBubbleChartDataSet
let copy = super.copy(with: zone) as! BarLineScatterCandleBubbleChartDataSet
copy.highlightColor = highlightColor
copy.highlightLineWidth = highlightLineWidth
copy.highlightLineDashPhase = highlightLineDashPhase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ open class BubbleChartDataEntry: ChartDataEntry

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! BubbleChartDataEntry
let copy = super.copy(with: zone) as! BubbleChartDataEntry
copy.size = size
return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ open class BubbleChartDataSet: BarLineScatterCandleBubbleChartDataSet, IBubbleCh

// MARK: - NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! BubbleChartDataSet
let copy = super.copy(with: zone) as! BubbleChartDataSet
copy._xMin = _xMin
copy._xMax = _xMax
copy._maxSize = _maxSize
copy.normalizeSizeEnabled = normalizeSizeEnabled
copy.highlightCircleWidth = highlightCircleWidth
return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ open class CandleChartDataEntry: ChartDataEntry

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! CandleChartDataEntry
let copy = super.copy(with: zone) as! CandleChartDataEntry
copy.high = high
copy.low = low
copy.open = open
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import Foundation

open class ChartDataEntry: ChartDataEntryBase
open class ChartDataEntry: ChartDataEntryBase, NSCopying
{
/// the x value
@objc open var x = Double(0.0)
Expand Down Expand Up @@ -79,7 +79,7 @@ open class ChartDataEntry: ChartDataEntryBase

// MARK: NSCopying

@objc open func copyWithZone(_ zone: NSZone?) -> AnyObject
open func copy(with zone: NSZone? = nil) -> Any
{
let copy = type(of: self).init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,15 @@ open class ChartDataSet: ChartBaseDataSet

// MARK: - NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! ChartDataSet
let copy = super.copy(with: zone) as! ChartDataSet

copy.values = values
copy._yMax = _yMax
copy._yMin = _yMin
copy._xMax = _xMax
copy._xMin = _xMin

return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,21 @@ open class LineChartDataSet: LineRadarChartDataSet, ILineChartDataSet

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! LineChartDataSet
let copy = super.copy(with: zone) as! LineChartDataSet
copy.circleColors = circleColors
copy.circleHoleColor = circleHoleColor
copy.circleRadius = circleRadius
copy.circleHoleRadius = circleHoleRadius
copy.cubicIntensity = cubicIntensity
copy.lineDashPhase = lineDashPhase
copy.lineDashLengths = lineDashLengths
copy.lineCapType = lineCapType
copy.drawCirclesEnabled = drawCirclesEnabled
copy.drawCircleHoleEnabled = drawCircleHoleEnabled
copy.mode = mode
copy._fillFormatter = _fillFormatter
return copy
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ open class LineRadarChartDataSet: LineScatterCandleRadarChartDataSet, ILineRadar

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! LineRadarChartDataSet
copy.fillColor = fillColor
let copy = super.copy(with: zone) as! LineRadarChartDataSet
copy.fill = fill
copy.fillAlpha = fillAlpha
copy._fillColor = _fillColor
copy._lineWidth = _lineWidth
copy.drawFilledEnabled = drawFilledEnabled
return copy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ open class LineScatterCandleRadarChartDataSet: BarLineScatterCandleBubbleChartDa

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! LineScatterCandleRadarChartDataSet
let copy = super.copy(with: zone) as! LineScatterCandleRadarChartDataSet
copy.drawHorizontalHighlightIndicatorEnabled = drawHorizontalHighlightIndicatorEnabled
copy.drawVerticalHighlightIndicatorEnabled = drawVerticalHighlightIndicatorEnabled
return copy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ open class PieChartDataEntry: ChartDataEntry

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! PieChartDataEntry
let copy = super.copy(with: zone) as! PieChartDataEntry
copy.label = label
return copy
}
Expand Down
15 changes: 13 additions & 2 deletions Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,22 @@ open class PieChartDataSet: ChartDataSet, IPieChartDataSet

// MARK: - NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! PieChartDataSet
let copy = super.copy(with: zone) as! PieChartDataSet
copy._sliceSpace = _sliceSpace
copy.automaticallyDisableSliceSpacing = automaticallyDisableSliceSpacing
copy.selectionShift = selectionShift
copy.xValuePosition = xValuePosition
copy.yValuePosition = yValuePosition
copy.valueLineColor = valueLineColor
copy.valueLineWidth = valueLineWidth
copy.valueLinePart1OffsetPercentage = valueLinePart1OffsetPercentage
copy.valueLinePart1Length = valueLinePart1Length
copy.valueLinePart2Length = valueLinePart2Length
copy.valueLineVariableLength = valueLineVariableLength
copy.entryLabelFont = entryLabelFont
copy.entryLabelColor = entryLabelColor
copy.highlightColor = highlightColor
return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ open class RadarChartDataEntry: ChartDataEntry

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! RadarChartDataEntry
let copy = super.copy(with: zone) as! RadarChartDataEntry

return copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ open class ScatterChartDataSet: LineScatterCandleRadarChartDataSet, IScatterChar

// MARK: NSCopying

open override func copyWithZone(_ zone: NSZone?) -> AnyObject
open override func copy(with zone: NSZone? = nil) -> Any
{
let copy = super.copyWithZone(zone) as! ScatterChartDataSet
let copy = super.copy(with: zone) as! ScatterChartDataSet
copy.scatterShapeSize = scatterShapeSize
copy.scatterShapeHoleRadius = scatterShapeHoleRadius
copy.scatterShapeHoleColor = scatterShapeHoleColor
Expand Down