我已经下载了 MPAndroidChart绘制折线图的库,我注意到此折线图总是在 yAxis 的顶部绘制 xAxis,我需要在 yAxis 的底部绘制 xAxis
这是我初始化图表的方式
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
mChart.setDragDecelerationFrictionCoef(0.9f);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setDrawGridBackground(false);
mChart.setHighlightPerDragEnabled(true);
mChart.setBackgroundColor(Color.WHITE);
XAxis xAxis = mChart.getXAxis();
xAxis.setDrawGridLines(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTextColor(ColorTemplate.getHoloBlue());
leftAxis.setAxisMaxValue(200f);
leftAxis.setDrawGridLines(false);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawAxisLine(false);
rightAxis.setTextColor(Color.WHITE);
rightAxis.setDrawGridLines(false);
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// set the marker to the chart
mChart.setMarkerView(mv);
最佳答案
试试这个:xAxis.setPosition(XAxisPosition.BOTTOM)
更多内容在 documentation .
关于android - MPAndroidChart 如何设置 x 轴到图表底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32847219/