-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI-627: vault landing screen graph #221
Conversation
@@ -120,6 +120,7 @@ import Foundation | |||
open func stringForValue(_ value: Double, axis _: AxisBase?) -> String { | |||
var result: String = "" | |||
if let anchor = GraphingAnchor.shared?.date { | |||
// what is 2500 here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruixhuang any idea on this number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure... Try changing it and see how it looks
fileprivate class TimeAxisValueFormatter: DateFormatter, IAxisValueFormatter { | ||
func stringForValue(_ value: Double, axis: AxisBase?) -> String { | ||
let date = Date(timeIntervalSince1970: value) | ||
return self.string(from: date) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative DateTimeAxisFormatter
seems to be doing a lot of work and it did not really match the vault designs for xAxis value formatting so I opted for a custom formatter which uses an out-of-the-box DateFormatter more or less. Unsure why DateTimeAxisFormatter
is so complicated.
// TODO: delete and replace with real data | ||
private var cancellables = Set<AnyCancellable>() | ||
init() { | ||
super.init() | ||
Timer.publish(every: 1, triggerNow: true) | ||
.sink { [weak self] _ in | ||
self?.setEntries() | ||
} | ||
.store(in: &cancellables) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for testing before abacus is hooked up
//TODO: remove | ||
// this is just for testing | ||
let now = Date().timeIntervalSince1970 | ||
let finalTimeSecondsAway = selectedValueTime == .oneDay ? 3600.0*24.0 : selectedValueTime == .sevenDays ? 3600.0*24.0*7.0 : 3600.0*24.0*30.0 | ||
let numEntries = Int.random(in: 0..<100) | ||
let entries = (0..<numEntries).map { i in | ||
ChartDataEntry(x: now + Double(i)/Double(numEntries) * finalTimeSecondsAway, y: Double.random(in: 0..<100)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for testing before abacus is hooked up
* add chart radio buttons * fine tune graph * comment * comment --------- Co-authored-by: Mike <[email protected]>
* add chart radio buttons * fine tune graph * comment * comment --------- Co-authored-by: Mike <[email protected]>
* add chart radio buttons * fine tune graph * comment * comment --------- Co-authored-by: Mike <[email protected]>
Links (dYdX Internal Use Only)
Linear Ticket: CLI-627: vault landing screen graph
Figma Design: design
Description / Intuition
Before/After Screenshots or Videos
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-08-07.at.11.43.50.mp4
Type of Change