Android:MPAndroidChart如何删除左侧行

Jan*_*abu 3 charts android mpandroidchart

对于折线图我正在使用mp android图表我想删除图形左侧而不是网格线的线.

码:-

    chart.setGridBackgroundColor(128);
    chart.setBorderColor(255);
    chart.getAxisRight().setEnabled(false);
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.setEnabled(false);
    chart.setDrawGridBackground(true);
    XAxis xAxis = chart.getXAxis();
    xAxis.setDrawGridLines(true);
    chart.getAxisRight().setDrawLabels(false);
    chart.getAxisLeft().setDrawLabels(false);
    chart.getLegend().setEnabled(false);
    chart.setPinchZoom(false);
    chart.setDescription("");
    chart.setTouchEnabled(false);
    chart.setDoubleTapToZoomEnabled(false);
    chart.getXAxis().setEnabled(true);
    chart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
    chart.getXAxis().setDrawGridLines(false);
    chart.invalidate();
Run Code Online (Sandbox Code Playgroud)

Mad*_*hur 11

添加以下代码,

 YAxis leftAxis = lineChart.getAxisLeft();
                leftAxis.setEnabled(false);
Run Code Online (Sandbox Code Playgroud)

您可以启用或禁用gridline,

lineChart.setDrawGridBackground(true);

XAxis xAxis = lineChart.getXAxis();
xAxis.setDrawGridLines(true);
xAxis.setDrawAxisLine(true);
Run Code Online (Sandbox Code Playgroud)

UPDATE

    chart.setGridBackgroundColor(128);
    chart.setBorderColor(255);
    chart.getAxisRight().setEnabled(false);
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.setEnabled(false);
    chart.setDrawGridBackground(true);
    chart.getAxisRight().setDrawLabels(false);
    chart.getAxisLeft().setDrawLabels(false);
    chart.getLegend().setEnabled(false);
    chart.setPinchZoom(false);
    chart.setDescription("");
    chart.setTouchEnabled(false);
    chart.setDoubleTapToZoomEnabled(false);
    chart.getXAxis().setEnabled(true);
    chart.setDrawGridBackground(true);//enable this too
    chart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
    chart.getXAxis().setDrawGridLines(true);//enable for grid line
    chart.getYAxis().setDrawGridLines(false);//disable vertical line
    chart.invalidate();
Run Code Online (Sandbox Code Playgroud)


Jan*_*abu 7

我通过添加以下行来获得

leftAxis.setDrawAxisLine(false);
Run Code Online (Sandbox Code Playgroud)