如何在MPAndroidChart中获取y轴标签的宽度 [英] How to get the width of y-axis label in MPAndroidChart
本文介绍了如何在MPAndroidChart中获取y轴标签的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取左侧y轴标签的宽度?或图表起点与y轴之间的间隔
How to get the width of left y-axis label? or the space between the start of chart and y-axis
推荐答案
如果您希望获得最长的标签宽度,则可以执行以下操作:
If you would like the get the longest label width then you can do:
chart.getRendererLeftYAxis()
.getPaintAxisLabels()
.measureText(chart.getAxisLeft().getLongestLabel())
或者您可以在标签的两边获取页边距:
Or you can get the margins on either side of the labels:
chart.getAxisLeft().getXOffset()
或者您可以获取轴的宽度(这是最后两个值的总和):
Or you can get the axis width (which are the last two values combined):
chart.getAxisLeft().getRequiredWidthSpace(
chart.getRendererLeftYAxis().getPaintAxisLabels())
这篇关于如何在MPAndroidChart中获取y轴标签的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文