MPAndroidChart设置图表填充/偏移 [英] MPAndroidChart setting chart padding / offset
本文介绍了MPAndroidChart设置图表填充/偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为条形图使用MPAndroidChart,并且正在努力删除图形的填充(请参见下图)
I'm using the MPAndroidChart for my bar graph and I'm struggling with removing the padding of the graph (see pic below)
我对这个问题的处理方法是:
My approaches regarding this problem were:
chart.setDrawLegend(false);
chart.setDrawMarkerViews(false);
chart.setDrawUnitsInChart(false);
chart.setDrawValueAboveBar(false);
chart.setDrawXLabels(false);
chart.setDrawYLabels(false);
chart.setDescription("");
chart.setOffsets(0, 0, 0, 0);
chart.getTransformer().prepareMatrixValuePx(chart);
chart.getTransformer().prepareMatrixOffset(chart);
chart.getContentRect().set(0, 0, chart.getWidth(),chart.getHeight());
到目前为止,没有任何工作.您知道解决此问题的另一种方法吗?
And nothing has worked so far. Do you know another approach for this problem?
推荐答案
我知道答案还很晚,但是现在Chart具有以下方法:
I know that's pretty late for answer, but now Chart has the following method:
setViewPortOffsets(-40f, 0f, 0f, 0f)
(将怪异的-40f值设置为0似乎是不自然的,但仍然可行)
(setting weird -40f value instead 0 seems unnatural, but it still works)
这篇关于MPAndroidChart设置图表填充/偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文