在 MPAndroidChart 中,在 y 轴和折线图开始和结束之间给出 space

In MPAndroidChart giving space between y-axis and line chart start and end

我正在使用 MPAndroidChart 开发具有一定价值的折线图。 这里的折线图是从 Y 轴开始到 end of the chart.

结束

请帮我给出一些 space 或在行的起点和垂直轴之间添加间隙,并且对于结尾也 like this。

我认为你应该使用条形图而不是折线图。

如果你使 space 看起来它不会从 x-0

开始

无法在行首和垂直轴之间添加额外的 space,但您可以通过轴最小值获得相同的结果,例如

lineChart.getXAxis().setAxisMinimum(-2);

您可以通过以下方法实现

//Leave some space before the line
xAxis.setSpaceMin(50f);
//Leave some space after the line
xAxis.setSpaceMax(50f);