gpt4 book ai didi

swift - 在 iOS 图表中隐藏分隔线和顶部边框线

转载 作者:搜寻专家 更新时间:2023-10-31 22:21:06 24 4
gpt4 key购买 nike

我有一个生成的图表。我试图让它尽可能简单,从而删除所有不需要的线条、网格、标签等。我无法摆脱条形图与顶部和右侧边框线之间的分隔线,如您所见图片。我正在使用 Horizo​​ntalBarChart。

enter image description here

另外,在这里你可以看到我的图表设置代码,我试图禁用所有的东西:

private func setupCharts(selectedHero: Int) {
classWinrateChart.descriptionText = ""
classWinrateChart.legend.enabled = false
classWinrateChart.drawBordersEnabled = false
classWinrateChart.drawMarkers = false
classWinrateChart.drawValueAboveBarEnabled = false

let chartDataSet = BarChartDataSet(yVals: dataSource, label: "Noaaah")
let chartData = BarChartData(xVals: ["", "", "", "", "", "", "", "", "", ""], dataSet: chartDataSet)
let color = constants.colors[selectedHero]
chartDataSet.colors = [color]
chartDataSet.valueFont = UIFont.systemFontOfSize(13)
//chartDataSet.drawValuesEnabled = false

let yAxis = classWinrateChart.leftAxis
let xAxis = classWinrateChart.rightAxis

yAxis.enabled = false
yAxis.drawLabelsEnabled = false
yAxis.drawAxisLineEnabled = false
yAxis.drawGridLinesEnabled = false

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

classWinrateChart.rightAxis.enabled = false

yAxis.axisMaxValue = 100
yAxis.axisMinValue = 0

classWinrateChart.tintColor = colors[selectedHero]

classWinrateChart.drawGridBackgroundEnabled = false
classWinrateChart.data = chartData
}

最佳答案

这可能对您有帮助:

    var viwBar = BarChartView()

viwBar.leftAxis.drawGridLinesEnabled = false
viwBar.rightAxis.drawGridLinesEnabled = false
viwBar.xAxis.drawGridLinesEnabled = false
viwBar.drawGridBackgroundEnabled = false

//removes left and right axis representation
let yaxis = viwBar.getAxis(ChartYAxis.AxisDependency.Left)
yaxis.drawLabelsEnabled = false
yaxis.enabled = false

let xaxis = viwBar.getAxis(ChartYAxis.AxisDependency.Right)
xaxis.drawLabelsEnabled = false
xaxis.enabled = false

关于swift - 在 iOS 图表中隐藏分隔线和顶部边框线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36807745/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com