You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the chart in my old app and now we are updating it to Swift 5, unfortunately, I am passing the data in the correct way but now change on the chart view.
extension blalbla {
func setupBarView() {
countView.text = ""
barView.delegate = self
barView.setVisibleXRange(minXRange: 1, maxXRange: 10)
barView.backgroundColor = UIColor.white
barView.leftAxis.enabled = false
barView.rightAxis.enabled = false
barView.xAxis.enabled = false
barView.xAxis.drawGridLinesEnabled = false
barView.xAxis.labelPosition = .bottom
barView.xAxis.valueFormatter = self
barView.xAxis.granularity = 1.0
barView.noDataText = "Grafik verisi mevcut değil"
// Refresh chart with new data
barView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
barView.notifyDataSetChanged()
}
func barChartUpdate() {
barView.data = nil
barChartEntry = []
monthTitles = []
for item in 0..<babyKickCountVM!.getBabyKickCount() {
let calendar = Calendar.current
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let date = dateFormatter.date(from: babyKickCountVM!.getBabyKickDateFor(index: item))
//let year = calendar.component(.year, from: date!)
let month = calendar.component(.month, from: date!)
let day = calendar.component(.day, from: date!)
monthTitles.append("\(day) \(months[month - 1])")
print("item: \(Double(item))")
print("item2: \(Double(babyKickCountVM!.getBabyKickCountFor(index: item)))")
let entry = BarChartDataEntry(x: Double(item), y: Double(babyKickCountVM!.getBabyKickCountFor(index: item)))
barChartEntry.append(entry)
}
barView.chartDescription?.text = "Empty data"
let dataSet = BarChartDataSet(entries: barChartEntry, label: "TEKME SAYAR")
let data = BarChartData(dataSets: [dataSet])
dataSet.colors = [UIColor.jokerColor]
dataSet.barBorderColor = UIColor.jokerColor
dataSet.barBorderWidth = 30
data.barWidth = 0.9
barView.data = data
barView.chartDescription?.text = ""
count = babyKickCountVM!.getBabyKickCountForToday()
countView.text = "\(count)"
barView.data?.notifyDataChanged()
}
}
The text was updated successfully, but these errors were encountered:
I used the chart in my old app and now we are updating it to Swift 5, unfortunately, I am passing the data in the correct way but now change on the chart view.
The text was updated successfully, but these errors were encountered: