Skip to content

Commit f7a648c

Browse files
authored
Merge pull request #3286 from danielgindi/3146
for #3146. add a warning message if pie chart has more than one data set
2 parents 3e36632 + ed8cf20 commit f7a648c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Source/Charts/Data/Implementations/Standard/PieChartData.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ open class PieChartData: ChartData
2323
super.init(dataSets: dataSets)
2424
}
2525

26+
/// - returns: All DataSet objects this ChartData object holds.
27+
@objc open override var dataSets: [IChartDataSet]
28+
{
29+
get
30+
{
31+
assert(super.dataSets.count <= 1, "Found multiple data sets while pie chart only allows one")
32+
return super.dataSets
33+
}
34+
set
35+
{
36+
super.dataSets = newValue
37+
}
38+
}
39+
2640
@objc var dataSet: IPieChartDataSet?
2741
{
2842
get

0 commit comments

Comments
 (0)