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
So, I am trying to draw a line chart on my app. And I found that somehow I could not assign the values to y axis. But x axis was totally fine. It assumed that the code might automatically generated the values from my data set.
So, I am trying to draw a line chart on my app. And I found that somehow I could not assign the values to y axis. But x axis was totally fine. It assumed that the code might automatically generated the values from my data set.
my code is like this below
// simple arrays
let data: [CGFloat] = [3, 4, -2, 11, 13, 15]
let data2: [CGFloat] = [1, 3, 5, 13, 17, 20]
// simple line with custom x axis labels
let xLabels: [String] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
let yLabels: [String] = ["0.1k", "0.2k", "0.3k", "0.4k", "0.5k", "0.6k"]
lineChart = LineChart()
lineChart.animation.enabled = true
lineChart.area = false
lineChart.x.labels.visible = true
lineChart.y.labels.visible = true
lineChart.y.axis.inset = 30
lineChart.x.axis.inset = 30
lineChart.x.grid.count = 5
lineChart.y.grid.count = 6
lineChart.x.labels.values = xLabels
lineChart.y.labels.values = yLabels
lineChart.addLine(data)
lineChart.addLine(data2)
lineChart.translatesAutoresizingMaskIntoConstraints = false
lineChart.delegate = self
chartView.addSubview(lineChart)
The text was updated successfully, but these errors were encountered: