Post

Replies

Boosts

Views

Activity

Comment on Charts Framework: chartYScale(domain:) scales the y-axis correctly but BarMarks are drawn down to bottom part of the screen
They most likely used a foregroundStyle with a linearGradient. An example would be similar to (assuming the charts left legend are these numbers, and the max is 11, the min is 8) let blueLocation: Double = 1 - ((11 - 9) / (11 - 8)) let yellowLocation: Double = 1 - ((11 - 10) / (11 - 8)) LineMark(x: .., y: ..).foregroundStyle(.linearGradient(stops: [.init(color: .blue, location 0.0), .init(color: .blue, location: blueLocation), .init(color: .yellow, location: blueLocation+.0001), .... ])
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’23
Comment on Charts Framework: chartYScale(domain:) scales the y-axis correctly but BarMarks are drawn down to bottom part of the screen
They most likely used a foregroundStyle with a linearGradient. An example would be similar to (assuming the charts left legend are these numbers, and the max is 11, the min is 8) let blueLocation: Double = 1 - ((11 - 9) / (11 - 8)) let yellowLocation: Double = 1 - ((11 - 10) / (11 - 8)) LineMark(x: .., y: ..).foregroundStyle(.linearGradient(stops: [.init(color: .blue, location 0.0), .init(color: .blue, location: blueLocation), .init(color: .yellow, location: blueLocation+.0001), .... ])
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23