I am doing a BarChart
with ios-chart
library. As it is similar to MPAndroidChart
I do not have a lot of problems creating them but I am not able to add a name/label above each column with the days of the week.
On Android, after setting the values to the respective BarDataSet
I used:
BarData data = new BarData(labels, dataset);
where labels are the name for each column and dataset is the BarDataSet.
The problem is that on Swift
I cannot find that way to add the labels for each column. This is the code that I have by the moment (a simple example):
@IBOutlet weak var barChartView: BarChartView!
var entries = [ChartDataEntry]()
entries.append(BarChartDataEntry(x: 1.0, yValues: [1.0], label: "Monday"))
entries.append(BarChartDataEntry(x: 2.0, yValues: [4.0], label: "Tuesday"))
let charDataSet = BarChartDataSet(values: entries, label: "legend")
let charData = BarChartData(dataSets: [charDataSet])
barChartView.data = charData
And here is the result:
but I am not able to put Monday
and Tuesday
values where 1.04, 1.12, 1.20... values appear. Further, I am not able to add the labels on BarChartData
function (as on Android
).
Where should I add Monday and Tuesday values to be shown above of each column?
Thanks in advance!