

График исчезает сразу после его построения. нигде я не устанавливаю данные графа в ноль. вот мой код Я пытался найти похожие проблемы в Google, не нашел ни одной полезной ссылки или вопроса.
func updateChartData() {
let yValues = self.modelController.getChartData()
guard !yValues.isEmpty else { return }
var dataSets = [LineChartDataSet]()
for i in 0..<yValues.count{
let yVals = yValues[i]
let dataSet = LineChartDataSet(values: yVals, label: nil)
dataSet.axisDependency = .left
dataSet.setColor(UIColor.asTurquoiseBlue)
dataSet.setCircleColor(UIColor.asTurquoiseBlue)
dataSet.lineWidth = 1
dataSet.circleRadius = 5
dataSet.circleHoleColor = .white
dataSet.drawCircleHoleEnabled = true
if i == yValues.count - 1 {
let gradientColors = [UIColor.asPaleBlue.cgColor, UIColor.white.cgColor]
let colorLocations:[CGFloat] = [1.0,0.0]
if let gradient = CGGradient.init(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: gradientColors as CFArray, locations: colorLocations){
let fill = Fill.fillWithLinearGradient(gradient, angle: 90)
dataSet.fill = fill
}
dataSet.drawFilledEnabled = true
}else{
dataSet.drawFilledEnabled = false
}
dataSets.append(dataSet)
}
let data = LineChartData(dataSets: dataSets)
data.setValueTextColor(.darkGray)
data.setValueFont(.systemFont(ofSize: 9))
data.setDrawValues(false)
self.chartView.data = data
self.chartView.animate(xAxisDuration: 1, easingOption: .easeInBack)
}