在X轴上显示所有数值,安卓工作室。

huangapple go评论66阅读模式
英文:

Display all values on X-axis android studio

问题

我在我的应用程序中使用GraphView实现了一个折线图,允许用户每天输入数据并按日期记录,但我遇到了一个问题,无法在x轴上显示所有的值。
我使用了以下代码来分隔块 weightGraph.getGridLabelRenderer().setNumHorizontalLabels(5); 然后效果如下图所示,值彼此重叠在一起。在X轴上显示所有数值,安卓工作室。

如果我将这段代码中的值从5更改为3,即 weightGraph.getGridLabelRenderer().setNumHorizontalLabels(3);,那么它就不会像下图那样显示所有的值。

在X轴上显示所有数值,安卓工作室。

是否有其他方法可以将所有x轴的值都显示出来,而不重叠呢?

英文:

I have implemented a line graph using graphview in my app that allows the user to input data daily and records it by the date, but I am having an issue to display all the values on the x-axis.
I used this line of to separate the blocks weightGraph.getGridLabelRenderer().setNumHorizontalLabels(5); and then looks like the image below where the values are overlapping each other. 在X轴上显示所有数值,安卓工作室。

and if I change the value of 5 to 3 in this codeweightGraph.getGridLabelRenderer().setNumHorizontalLabels(3); then it does not display all the values like the picture below.

在X轴上显示所有数值,安卓工作室。

Is there any other way to display it so all the x-axis values are visible, with it overlapping.

答案1

得分: 0

你可以使用.setHorizontalLabelsAngle(90);来显示垂直方向(或至少倾斜角度)。

英文:

You can show vertical (or at least at an angle) using .setHorizontalLabelsAngle(90);

答案2

得分: 0

我已经决定删除这行代码 weightGraph.getGridLabelRenderer().setNumHorizontalLabels(10);,这使得图表可以每天按需增长,但我添加了这行代码,以便 x 值不会彼此重叠。weightGraph.getGridLabelRenderer().setHorizontalLabelsAngle(45);

英文:

I have decided to remove this line of code weightGraph.getGridLabelRenderer().setNumHorizontalLabels(10);
Which enables the graph to increase as it wants daily but I did add this line of code so the x values do not overlap each other. weightGraph.getGridLabelRenderer().setHorizontalLabelsAngle(45);

huangapple
  • 本文由 发表于 2020年10月7日 17:11:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/64240883.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定