I'm using Swift Charts to create a heat map as shown below and there are faint lines in the chart. In the screen shot, you can see the line in the Digital Color Meter window. I thought the lines were the grid lines of the chart but I made the X and Y axis hidden and the lines still appear. Any ideas on what is causing these lines to appear and how can I remove them?
import SwiftUI
import Charts
struct Point: Hashable, Identifiable {
let id = UUID()
let x: Int
let y: Int
let val: Float
}
struct Grid {
let rows: Int
let columns: Int
var points = [Point]()
init(rows: Int, columns: Int) {
self.rows = rows
self.columns = columns
generateData()
}
mutating func generateData() {
for i in 0..<rows {
for j in 0..<columns {
let v = Float.random(in: 0...1)
let point = Point(x: j, y: i, val: v)
points.append(point)
}
}
}
}
struct ContentView: View {
@State private var grid = Grid(rows: 10, columns: 10)
var body: some View {
Chart(grid.points) { point in
RectangleMark(
xStart: .value("xStart", point.x),
xEnd: .value("xEnd", point.x + 1),
yStart: .value("yStart", point.y),
yEnd: .value("yEnd", point.y + 1)
)
.foregroundStyle(by: .value("Weight", point.val))
}
.chartYAxis(.hidden)
.chartXAxis(.hidden)
.chartForegroundStyleScale(range: Gradient(colors: [.yellow, .red]))
.padding()
.frame(minWidth: 400, minHeight: 400)
}
}