我正在使用https://github.com/danielgindi/Charts
如何隐藏每个栏中显示的值。 我的代码如下
func setUpChartView(){
viewGraphContent.delegate = self
viewGraphContent.pinchZoomEnabled = false
viewGraphContent.chartDescription?.enabled = true
viewGraphContent.dragEnabled = false
viewGraphContent.setScaleEnabled(false)
viewGraphContent.highlightFullBarEnabled = true
viewGraphContent.doubleTapToZoomEnabled = false
viewGraphContent.drawBordersEnabled = true
viewGraphContent.borderColor = UIColor.white
viewGraphContent.borderLineWidth = 1
viewGraphContent.legend.enabled = false
}
答案 0 :(得分:3)
在设置图表集的位置添加以下代码行以解决问题:
var set = BarChartDataSet(values: yVals, label: "Data Set")
set.drawValuesEnabled = false // Set this property to false to hide all values
let data = BarChartData(dataSet: set)
yourChartView.data = data
此代码将隐藏条形图上方的所有值。希望对您有帮助。