Reputation: 15
I want it like this:
But what I can do is, how to get rid of little red label:
Core code for the chart:
var barchart = [BarChartDataEntry]()
// some values
barchart.append(value1)
barchart.append(value2)
barchart.append(value3)
let barData = BarChartDataSet(values: barchart, label: "")
barData.colors = [NSUIColor.red]
let data = BarChartData(dataSet: barData)
data.barWidth = 0.35
cell.barChart.data = data
cell.barChart.scaleYEnabled = false
cell.barChart.chartDescription?.text = ""
cell.barChart.scaleXEnabled = false
cell.barChart.pinchZoomEnabled = false
cell.barChart.doubleTapToZoomEnabled = false
cell.barChart.rightAxis.enabled = false
cell.barChart.xAxis.drawGridLinesEnabled = false
cell.barChart.leftAxis.drawGridLinesEnabled = false
cell.barChart.leftAxis.drawAxisLineEnabled = false
cell.barChart.xAxis.drawAxisLineEnabled = false
cell.barChart.xAxis.drawLabelsEnabled = false
cell.barChart.leftAxis.drawLabelsEnabled = false
cell.barChart.animate(yAxisDuration: 1.5, easingOption: .easeInOutQuart)
return cell
I would like to set max value and make labels rounded as in the image above. I am using https://github.com/danielgindi/Charts.
Upvotes: 0
Views: 3330
Reputation: 2916
You can implement the similar UI by using the UIProgressView
First, you can set the Label on top, then a UIProgressView and repeat the same. For other two progresses.
You can add the proper constraints and achieve it.
Refer this Sample Demo for achieving the same.
Hope it helps.
Upvotes: 1
Reputation: 1240
Use UIProgressView component in storyboard and create the outlet
@IBOutlet var progressViewWalk: UIProgressView!
You can set the required progress by:-
progressViewWalk.progress = Float(YOURValue)/100
Set your required Track tint color Progress tint color in Attribute Inspector
.
Upvotes: 0
Reputation: 1616
Just add this line where you are setting chartView
cell.barChart.legend.enabled = false
It works for me.
Upvotes: 1