ebaaf81d19
* feat: new protocol for chained functions, and added support for explicit Y ranges. X coming as well * feat: add new axis interface (#253)
29 lines
857 B
Swift
29 lines
857 B
Swift
import SwiftUI
|
|
|
|
struct ChartGridShape: Shape {
|
|
var numberOfHorizontalLines: Int
|
|
var numberOfVerticalLines: Int
|
|
|
|
func path(in rect: CGRect) -> Path {
|
|
let path = Path.drawGridLines(numberOfHorizontalLines: numberOfHorizontalLines,
|
|
numberOfVerticalLines: numberOfVerticalLines,
|
|
in: rect)
|
|
return path
|
|
}
|
|
}
|
|
|
|
struct ChartGridShape_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group {
|
|
ChartGridShape(numberOfHorizontalLines: 5, numberOfVerticalLines: 0)
|
|
.stroke()
|
|
.toStandardCoordinateSystem()
|
|
|
|
ChartGridShape(numberOfHorizontalLines: 4, numberOfVerticalLines: 4)
|
|
.stroke()
|
|
.toStandardCoordinateSystem()
|
|
}
|
|
.padding()
|
|
}
|
|
}
|