-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Label,Value pairs so you can display a label for each point in …
…Bar chart, added ability to change ecg image in the corner, added Generic number types to ChartData initialiser
- Loading branch information
Showing
19 changed files
with
213 additions
and
60 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
.swiftpm/xcode/xcuserdata/samuandris.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>SwiftUICharts.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>1</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// LabelView.swift | ||
// BarChart | ||
// | ||
// Created by Samu András on 2020. 01. 08.. | ||
// Copyright © 2020. Samu András. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LabelView: View { | ||
@Binding var arrowOffset: CGFloat | ||
@Binding var title:String | ||
var body: some View { | ||
VStack{ | ||
ArrowUp().fill(Color.white).frame(width: 20, height: 12, alignment: .center).shadow(color: Color.gray, radius: 8, x: 0, y: 0).offset(x: getArrowOffset(offset:self.arrowOffset), y: 12) | ||
ZStack{ | ||
RoundedRectangle(cornerRadius: 8).frame(width: 100, height: 32, alignment: .center).foregroundColor(Color.white).shadow(radius: 8) | ||
Text(self.title).font(.caption).bold() | ||
ArrowUp().fill(Color.white).frame(width: 20, height: 12, alignment: .center).zIndex(999).offset(x: getArrowOffset(offset:self.arrowOffset), y: -20) | ||
|
||
} | ||
} | ||
} | ||
|
||
func getArrowOffset(offset: CGFloat) -> CGFloat { | ||
return max(-36,min(36, offset)) | ||
} | ||
} | ||
|
||
struct ArrowUp: Shape { | ||
func path(in rect: CGRect) -> Path { | ||
var path = Path() | ||
path.move(to: CGPoint(x: 0, y: rect.height)) | ||
path.addLine(to: CGPoint(x: rect.width/2, y: 0)) | ||
path.addLine(to: CGPoint(x: rect.width, y: rect.height)) | ||
path.closeSubpath() | ||
return path | ||
} | ||
} | ||
|
||
struct LabelView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LabelView(arrowOffset: .constant(0), title: .constant("Tesla model 3")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.