Skip to content

Commit 26d6a64

Browse files
authored
Merge pull request #7 from ar-rahimi/feature/add-label-to-piechart-slices
fixed issue
2 parents 35b2ca0 + fdac850 commit 26d6a64

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Sources/SwiftUICharts/Helpers.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,20 @@ public class ChartData: ObservableObject, Identifiable {
213213
}
214214
}
215215

216+
public struct PieChartData {
217+
var label: String = ""
218+
var value: Double
219+
220+
public init(value: Double) {
221+
self.value = value
222+
}
223+
224+
public init(label: String, value: Double) {
225+
self.label = label
226+
self.value = value
227+
}
228+
}
229+
216230
public class MultiLineChartData: ChartData {
217231
var gradient: GradientColor
218232

Sources/SwiftUICharts/PieChart/PieChartRow.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
import SwiftUI
1010

11-
public struct PieChartData {
12-
var label: String = ""
13-
var value: Double
14-
}
15-
1611
public struct PieChartRow : View {
1712
var data: [PieChartData]
1813
var labeledData: [(String, Double)]?

0 commit comments

Comments
 (0)