Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c6610f5679 | |||
| 47052674f5 | |||
| a36c1db2f8 | |||
| ca19dd578c |
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
@@ -7,7 +7,7 @@
|
||||
<key>SwiftUICharts.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Swift package for displaying charts effortlessly.
|
||||
|
||||
**First release of version 2.0 is coming soon! Also iOS 14 WidgetKit support is coming. I will update current charts and possibly extend with some new chart types to provide the best support for building informative and beautiful widgets for the new home screen 🥳 Stay tuned!**
|
||||
|
||||

|
||||
|
||||
### Note:
|
||||
|
||||
@@ -34,7 +34,6 @@ public struct Line: View {
|
||||
if minDataValue != nil && maxDataValue != nil {
|
||||
min = minDataValue!
|
||||
max = maxDataValue!
|
||||
print(min,max)
|
||||
}else if let minPoint = points.min(), let maxPoint = points.max(), minPoint != maxPoint {
|
||||
min = minPoint
|
||||
max = maxPoint
|
||||
|
||||
@@ -14,7 +14,7 @@ public struct MultiLineChartView: View {
|
||||
public var legend: String?
|
||||
public var style: ChartStyle
|
||||
public var darkModeStyle: ChartStyle
|
||||
public var formSize:CGSize
|
||||
public var formSize: CGSize
|
||||
public var dropShadow: Bool
|
||||
public var valueSpecifier:String
|
||||
|
||||
@@ -44,27 +44,27 @@ public struct MultiLineChartView: View {
|
||||
}
|
||||
|
||||
var frame = CGSize(width: 180, height: 120)
|
||||
private var rateValue: Int
|
||||
private var rateValue: Int?
|
||||
|
||||
public init(data: [([Double], GradientColor)],
|
||||
title: String,
|
||||
legend: String? = nil,
|
||||
style: ChartStyle = Styles.lineChartStyleOne,
|
||||
form: CGSize? = ChartForm.medium,
|
||||
rateValue: Int? = 14,
|
||||
dropShadow: Bool? = true,
|
||||
valueSpecifier: String? = "%.1f") {
|
||||
form: CGSize = ChartForm.medium,
|
||||
rateValue: Int? = nil,
|
||||
dropShadow: Bool = true,
|
||||
valueSpecifier: String = "%.1f") {
|
||||
|
||||
self.data = data.map({ MultiLineChartData(points: $0.0, gradient: $0.1)})
|
||||
self.title = title
|
||||
self.legend = legend
|
||||
self.style = style
|
||||
self.darkModeStyle = style.darkModeStyle != nil ? style.darkModeStyle! : Styles.lineViewDarkMode
|
||||
self.formSize = form!
|
||||
self.formSize = form
|
||||
frame = CGSize(width: self.formSize.width, height: self.formSize.height/2)
|
||||
self.rateValue = rateValue!
|
||||
self.dropShadow = dropShadow!
|
||||
self.valueSpecifier = valueSpecifier!
|
||||
self.rateValue = rateValue
|
||||
self.dropShadow = dropShadow
|
||||
self.valueSpecifier = valueSpecifier
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
@@ -86,12 +86,12 @@ public struct MultiLineChartView: View {
|
||||
.foregroundColor(self.colorScheme == .dark ? self.darkModeStyle.legendTextColor : self.style.legendTextColor)
|
||||
}
|
||||
HStack {
|
||||
if (self.rateValue >= 0){
|
||||
if (rateValue ?? 0 >= 0){
|
||||
Image(systemName: "arrow.up")
|
||||
}else{
|
||||
Image(systemName: "arrow.down")
|
||||
}
|
||||
Text("\(self.rateValue)%")
|
||||
Text("\(rateValue ?? 0)%")
|
||||
}
|
||||
}
|
||||
.transition(.opacity)
|
||||
|
||||
Reference in New Issue
Block a user