我正在做一个应用程序,该应用程序对区域中的wifi进行扫描。因此,当我使用mpandroidchart 3库在barchart中绘制该信息时遇到问题。
问题在于,只要该值接近零,信号就会更好 如上图所示。 https://imgur.com/a/vYT7ry3
但是对于我的应用程序,我没有得到相同的结果,问题是我的轴总是开始为零,并且我不想因为例如代表-21 dbm的条必须比代表dbm的条高-70 dbm,但我的应用程序却发生了相反的情况。还是可以使用另一个图表库获取任务=? https://imgur.com/a/yHUtaE8
我使用了有关创建条形图的代码
mChart.setDrawGridBackground(false);
mChart.getDescription().setEnabled(false);
mChart.setDrawBorders(false);
mChart.getAxisLeft().setEnabled(true);
mChart.getAxisRight().setDrawAxisLine(true);
mChart.getAxisRight().setDrawGridLines(true);
mChart.getXAxis().setDrawAxisLine(true);
mChart.getXAxis().setDrawGridLines(true);
mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
mChart.getXAxis().setGranularity(1);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.getLegend().setWordWrapEnabled(true);
mBarChart.setDrawGridBackground(false);
mBarChart.getDescription().setEnabled(false);
mBarChart.setDrawBorders(false);
mBarChart.setDrawValueAboveBar(false);
mBarChart.getAxisLeft().setEnabled(true);
mBarChart.getAxisRight().setDrawAxisLine(true);
mBarChart.getAxisRight().setDrawGridLines(true);
mBarChart.getXAxis().setDrawAxisLine(true);
mBarChart.getXAxis().setDrawGridLines(true);
mBarChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
mBarChart.getXAxis().setGranularity(1);
// enable touch gestures
mBarChart.setTouchEnabled(true);
// enable scaling and dragging
mBarChart.setDragEnabled(true);
mBarChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mBarChart.setPinchZoom(false);
final XAxis xAxis = mBarChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(true);
//xAxis.setLabelRotationAngle(90);
YAxis leftAxis =mBarChart.getAxisLeft();
leftAxis.setInverted(true);
leftAxis.setAxisMinimum(-100);
leftAxis.setAxisMaximum(-20);
leftAxis.setLabelCount(5);
YAxis rightAxis =mBarChart.getAxisRight();
rightAxis.setInverted(true);
rightAxis.setDrawTopYLabelEntry(false);
rightAxis.setInverted(true);
rightAxis.setAxisMinimum(-100);
rightAxis.setAxisMaximum(-20);
rightAxis.setLabelCount(5);