MPAndroidChart - Remove top border / axis since v2

﹥>﹥吖頭↗ 提交于 2019-12-10 14:58:18

问题


I upgraded MPAndroidChart from v1.7 to v2 and had to change a couple things. One of the new things is that i now appear to have a top border for the maximum value.

My code trying to hide all borders is like this:

    LineChart graph = (LineChart) connectionView.findViewById(R.id.graph);
    graph.setDrawGridBackground(false);
    graph.setDrawBorders(false);
    graph.setDescription("");

    YAxis yr = graph.getAxisRight();
    yr.setEnabled(false);
    yr.setDrawAxisLine(false);

    YAxis yl = graph.getAxisLeft();
    yl.setValueFormatter(formatierer);
    yl.setShowOnlyMinMax(true);
    yl.setDrawAxisLine(false);

    XAxis xl = graph.getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setDrawGridLines(false);
    xl.setDrawAxisLine(false);

    yl.setAxisMaxValue((float) graphpoint_max);

Still - i have a line showing the maximum value. I want to have the values on the YAxis but have no horizontal axis lines / borders. I wasn't able to find any command to hide it.


回答1:


Have you tried calling setDrawAxisLine(...) or setDrawGridLines(...) on the YAxis?

Here is the full axis documentation.

And here is the documentation for YAxis only.




回答2:


The top line is drawn as part of the X axis. You need to call this to get rid of it: chart.getXAxis().setDrawAxisLine(false);.



来源:https://stackoverflow.com/questions/30164862/mpandroidchart-remove-top-border-axis-since-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!