公告
财富商城
积分规则
提问
发文
2019-06-13 16:25发布
Juvenile、少年°
What can I do to fix the legend overlapping in androidplot?
Can I manipulate the legend placement?
You can use this to enlarge the legend:
myPlot.getLegendWidget().setSize(new SizeMetrics(15, SizeLayoutType.ABSOLUTE, 200, SizeLayoutType.ABSOLUTE));
15 is the height and 200 the width. Change the legend position:
myPlot.position( myPlot.getLegendWidget(), 0, XLayoutStyle.ABSOLUTE_FROM_RIGHT, 0, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.RIGHT_BOTTOM);
And reposition the domain label if you need to:
myPlot.position(myPlot.getDomainLabelWidget(), 0, XLayoutStyle.ABSOLUTE_FROM_LEFT, 15, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.LEFT_BOTTOM);
Some of the methods used in the above answer did not work for me. I guess things have changed in 4 years. Following code worked for me.
dynamicPlot.getLegendWidget().setSize(new Size(25, SizeLayoutType.ABSOLUTE, 400, SizeLayoutType.ABSOLUTE)); dynamicPlot.getLegendWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_RIGHT, 0, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.RIGHT_BOTTOM); dynamicPlot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_LEFT, 30, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.LEFT_BOTTOM);`
change the layoutStyle and offsets as per your needs.
最多设置5个标签!
You can use this to enlarge the legend:
15 is the height and 200 the width.
Change the legend position:
And reposition the domain label if you need to:
Some of the methods used in the above answer did not work for me. I guess things have changed in 4 years. Following code worked for me.
change the layoutStyle and offsets as per your needs.