Data in List cells changes when scrolling
I have a List
in which each cell has a chart. The data for the list is generated once and stored in the chartData
property. However, there is a bug. When scrolling the list, the charts in the cells change places: if we scroll the list a couple of cells down and then return to the top, then the first cell will have a completely different chart from what was before scrolling. However, only the chart changes, the number Text
remains unchanged
SwiftUI: Data in List cells changes when scrolling
I have a List
in which each cell has a chart. The data for the list is generated once and stored in the chartData
property. However, there is a bug. When scrolling the list, the charts in the cells change places: if we scroll the list a couple of cells down and then return to the top, then the first cell will have a completely different chart from what was before scrolling. However, only the chart changes, the number Text
remains unchanged
Dynamic height for RectangleMarks
I am currently using two lineMarks on my chart to signify a graph’s upper and lower limit. Ideally, the upper limit would be a rectangle mark extending to the top of the graph shaded red and the same for the lower limit except extending to the bottom. My issue is that for a rectangle mark it needs am ended y value but I want my chart’s y axis to be populated automatically so I don’t know how to get the highest and lowest y value for these rectangle marks.
Swift Chart Color Legend Dynamically
I’m relatively new to SwiftUI, completely new to Swift Charts, and I seem to have run into a wall. I am trying to get my graph to reflect the colors present in entryObservation.subject.color
but if I use a simple .foregroundStyle(entryObservation.subject.color)
then the legend doesn’t show, even when I explicitly tell it to with .chartLegend(.visible)
, and if I use .foregroundStyle(by: .value("Subject", entryObservation.subject.name))
then the chart doesn’t reflect the color in my data, but the legend shows.