Compare commits

...

3 Commits

Author SHA1 Message Date
Andras Samu 20fb782a3e quick fix for 0 elements in line view 2019-11-13 10:16:39 +01:00
Andras Samu 9fa7e20221 Merge remote-tracking branch 'refs/remotes/origin/master' 2019-11-13 10:00:49 +01:00
Andras Samu 1b45a6a922 Update README.md 2019-11-11 21:53:57 +01:00
4 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ Added an example project, with **iOS, watchOS** target: https://github.com/AppPe
**New full screen view called LineView!!!**
![Line Charts](./fullscreen1.gif "Line Charts")![Line Charts](./fullscreen2.gif "Line Charts")
![Line Charts](./fullscreen2.gif "Line Charts")
```swift
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen") // legend is optional, use optional .padding()
@@ -22,6 +22,7 @@ public struct BarChartRow : View {
ForEach(0..<self.data.count) { i in
BarChartCell(value: self.normalizedValue(index: i), index: i, width: Float(geometry.frame(in: .local).width - 22), numberOfDataPoints: self.data.count, accentColor: self.accentColor, secondGradientAccentColor: self.secondGradientAccentColor, touchLocation: self.$touchLocation)
.scaleEffect(self.touchLocation > CGFloat(i)/CGFloat(self.data.count) && self.touchLocation < CGFloat(i+1)/CGFloat(self.data.count) ? CGSize(width: 1.4, height: 1.1) : CGSize(width: 1, height: 1), anchor: .bottom)
.animation(.spring())
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ struct Legend: View {
func getYLegend() -> [Int]? {
guard let max = data.points.max() else { return nil }
guard let min = data.points.min() else { return nil }
if(min > 0){
if(min >= 0){
let upperBound = ((max/10)+1) * 10
let step = upperBound/4
return [step * 0,step * 1, step * 2, step * 3, step * 4]