Ios 条形图给出的是负值
我正在使用Charts API并实现chart。我是这方面的新手,没有Swift 3的适当文档 我尝试并实施了,但不知道如何消除y的负刻度。如何仅从0开始图形,使其不显示负y比例 下面是我的代码:Ios 条形图给出的是负值,ios,charts,swift3,xscale,Ios,Charts,Swift3,Xscale,我正在使用Charts API并实现chart。我是这方面的新手,没有Swift 3的适当文档 我尝试并实施了,但不知道如何消除y的负刻度。如何仅从0开始图形,使其不显示负y比例 下面是我的代码: fileprivate func ChartViewProperty() { barChartView.xAxis.labelPosition = .bottom barChartView.chartDescription?.text = "" barChartView.fi
fileprivate func ChartViewProperty() {
barChartView.xAxis.labelPosition = .bottom
barChartView.chartDescription?.text = ""
barChartView.fitBars = true
barChartView.pinchZoomEnabled = false
self.barChartView.rightAxis.enabled = false
barChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
barChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInBounce)
barChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values:months)
barChartView.xAxis.granularity = 1
value.append([jan,feb,mar,apr,may,jun,jly,aug,sep,oct,nov,dec])
setChart(dataPoints: months, values: value)
}.
图片:
尝试设置axisMinValue属性
我猜barChartView.xAxis.axisMinValue这行删除了条形图中的所有负值:
fileprivate func ChartViewProperty() {
//barChartView.xAxis.drawGridLinesEnabled = false
barChartView.xAxis.drawAxisLineEnabled = false
//barChartView
barChartView.xAxis.drawLabelsEnabled = true
//Space between x axis
barChartView.xAxis.spaceMin = 1.0
barChartView.xAxis.spaceMax = 1.0
//Left axis bottom
barChartView.leftAxis.spaceBottom = 0.0
//Label Position
barChartView.xAxis.labelPosition = .bottom
//Description
barChartView.chartDescription?.text = ""
//Fit Bar
barChartView.fitBars = false
//Pinch Zoom
barChartView.pinchZoomEnabled = false
//Right x axis enabled
self.barChartView.rightAxis.enabled = false
//Animate barchart
barChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0)
barChartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInBounce)
}
chartView.rightAxis.axisMinimum = 0
我试过了,但没用。我做了barChartView.xAxis.axisMinValue=0.5有什么解决方案吗?试试这个barChartView.leftAxis.Axisminum=0这是问题的答案还是补充?