Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04b6e385ea |
@@ -15,7 +15,7 @@ struct Line: View {
|
||||
@Binding var showIndicator: Bool
|
||||
@State private var showFull: Bool = false
|
||||
@State var showBackground: Bool = true
|
||||
let padding:CGFloat = 3
|
||||
let padding:CGFloat = 30
|
||||
var stepWidth: CGFloat {
|
||||
if data.points.count < 2 {
|
||||
return 0
|
||||
@@ -24,7 +24,7 @@ struct Line: View {
|
||||
}
|
||||
var stepHeight: CGFloat {
|
||||
if let min = data.points.min(), let max = data.points.max(), min != max {
|
||||
if (min < 0){
|
||||
if (min <= 0){
|
||||
return (frame.size.height-padding) / CGFloat(data.points.max()! - data.points.min()!)
|
||||
}else{
|
||||
return (frame.size.height-padding) / CGFloat(data.points.max()! + data.points.min()!)
|
||||
|
||||
@@ -72,14 +72,14 @@ public struct LineChartView: View {
|
||||
Spacer()
|
||||
}
|
||||
.transition(.scale)
|
||||
.animation(.spring())
|
||||
// .animation(.spring())
|
||||
|
||||
}
|
||||
Spacer()
|
||||
GeometryReader{ geometry in
|
||||
Line(data: self.data, frame: .constant(geometry.frame(in: .local)), touchLocation: self.$touchLocation, showIndicator: self.$showIndicatorDot)
|
||||
}
|
||||
.frame(width: frame.width, height: frame.height)
|
||||
.frame(width: frame.width, height: frame.height + 30)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 20))
|
||||
.offset(x: 0, y: 0)
|
||||
}.frame(width: self.formSize.width, height: self.formSize.height)
|
||||
|
||||
Reference in New Issue
Block a user