iOS 图表删除条形图条形图上的值

iOS Charts remove values on the bar of the bar chart

我正在使用 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
  }

在您设置图表集的位置添加以下代码行以解决您的问题:

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

此代码将隐藏条形图上方的所有值。希望对您有所帮助。