ios – 在水平条形图中隐藏底部x轴?

前端之家收集整理的这篇文章主要介绍了ios – 在水平条形图中隐藏底部x轴?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想使用不渲染任何x轴或网格线的ios图表渲染(堆叠)水平条形图.我已经禁用了我能找到的每个设置,但是底部的x轴仍然呈现.
func setUpBarChart() {
    // General bar chart settings
    barChart.pinchZoomEnabled = false
    barChart.drawGridBackgroundEnabled = false
    barChart.drawBarShadowEnabled = false
    barChart.drawValueAboveBarEnabled = false
    barChart.drawBordersEnabled = false
    barChart.drawMarkers = false
    barChart.legend.enabled = false
    barChart.descriptionText = ""
    barChart.drawBordersEnabled = false

    // Left-axis settings
    barChart.leftAxis.drawLabelsEnabled = false
    barChart.leftAxis.drawTopYLabelEntryEnabled = false
    barChart.leftAxis.drawAxisLineEnabled = false

    // x-axis settings

    barChart.xAxis.drawAxisLineEnabled = false
    barChart.xAxis.drawGridLinesEnabled = false
    barChart.xAxis.drawLabelsEnabled = false
    barChart.xAxis.enabled = false

    // add some dummy data
    let entry = BarChartDataEntry(values: [10,2,5],xIndex: 0)
    let set = BarChartDataSet(yVals: [entry],label: nil)
    set.colors = [UIColor.greenColor(),UIColor.yellowColor(),UIColor.redColor()]
    set.drawValuesEnabled = false

    let data = BarChartData(xVals: [""],dataSet: set)
    barChart.data = data
}

代码导致以下呈现:

如何删除底轴渲染和垂直值线?

解决方法

终于想通了.由于这是一个Horizo​​ntalBarChart,因此轴的名称稍微偏离.在此图底部渲染的轴实际上是rightAxis.因此,这段代码可以解决问题:
barChart.rightAxis.enabled = false
原文链接:https://www.f2er.com/iOS/327827.html

猜你在找的iOS相关文章