now it is possible to add background lines precisely as charts are displayed at correct size also rewrote basics to conform with Shapes and Animatable protocol
20 lines
905 B
Swift
20 lines
905 B
Swift
import SwiftUI
|
|
|
|
struct LineBackgroundShapeView: View {
|
|
var chartData: ChartData
|
|
var geometry: GeometryProxy
|
|
var style: ChartStyle
|
|
|
|
var body: some View {
|
|
LineBackgroundShape(data: chartData.normalisedPoints)
|
|
.transform(CGAffineTransform(scaleX: geometry.size.width / CGFloat(chartData.normalisedPoints.count - 1),
|
|
y: geometry.size.height / CGFloat(chartData.normalisedRange)))
|
|
.fill(LinearGradient(gradient: Gradient(colors: [style.foregroundColor.first?.startColor ?? .white,
|
|
style.backgroundColor.startColor]),
|
|
startPoint: .bottom,
|
|
endPoint: .top))
|
|
.rotationEffect(.degrees(180), anchor: .center)
|
|
.rotation3DEffect(.degrees(180), axis: (x: 0, y: 1, z: 0))
|
|
}
|
|
}
|