[英]MPAndroidChart:- How to reduce the distance between the x axis points in a line chart?
I am plotting a real time data using MPAndroidChart. 我正在使用MPAndroidChart绘制实时数据。 The X axis and Y axis are defined as below.
X轴和Y轴定义如下。 Data is populating to the graph without any issues.
数据正在填充到图中,没有任何问题。 The result is supposed to be in a wave form.
结果应该是波形形式。 Since the Y axis range is too high I am getting the values as lines.
由于Y轴范围太大,因此我将这些值表示为线。 Could anyone help me on how to adjust the X axis range based on the Y axis vale, so that it can plot the values correctly.
谁能帮助我如何基于Y轴调整X轴范围,以便它可以正确绘制值。
XAxis xl = mChart.getXAxis();
xl.setTextColor(Color.WHITE);
xl.setDrawGridLines(false);
xl.setDrawLabels(false);
xl.setAvoidFirstLastClipping(true);
xl.setSpaceBetweenLabels(5);
xl.setEnabled(true);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTextColor(Color.WHITE);
leftAxis.setAxisMaxValue(4000f);
leftAxis.setAxisMinValue(-4000f);
leftAxis.setDrawGridLines(true);
Setting the chart property chart.setVisibleXRange(100,100) properly solved my issue. 设置图表属性chart.setVisibleXRange(100,100)可以正确解决我的问题。 There was nothing to do with the X-axis value.
与X轴值无关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.