iOS-Charts - yAxis标签无法从底部开始

时间:2016-07-11 10:10:48

标签: ios swift ios-charts

我在我的项目中使用Charts swift库。我在折线图中使用了两个数据集,但是Yaxis的标签并不是从底部开始。我希望yAxis上的第一个标签正好位于图表的左下角。我尝试设置yAxis的最小值,但它没有帮助。

以下是示例图片。

Image

1 个答案:

答案 0 :(得分:2)

You need to make use of leftAxis.axisMinValue on your LineChartView property, or whatever type of chart you are graphing. If you set it to 0, then the "0.0" in your chart will be positioned correctly at the very bottom. You can set this to other values and the chart will start at those values too.

Here is a simple example of it in action:

@IBOutlet weak var yourChartViewController: LineChartView! // View controller for the chart in a storyboard.
// Set up your data for the chart...

// Configuring the chart's view
yourChartViewController.leftAxis.axisMinValue = 0  // This is what you need