【问题标题】:AndroidPlot: Positioning and Aligning domain value labelsAndroidPlot:定位和对齐域值标签
【发布时间】:2013-10-29 11:33:25
【问题描述】:

我在 AndroidPlot 中定位和对齐域值时遇到问题。我附上了我目前所拥有的截图。

问题 1(定位): 由于我将 Unix 时间戳格式化为 MMM-yy 并将域标签方向设置为 -90 度,因此标签往往会与图形区域重叠(如下图所示) )。有没有办法移动域标签?我更喜欢使用setDomainLabelVerticalOffset(),因为XYGraphWidget 不会重新调整自身大小以适应偏移带来的变化。

问题 2(对齐):域标签似乎从底部对齐。如果您查看下面屏幕截图中的“Jul-07”和“May-09”标签,这一点非常清楚。是否可以从顶部对齐标签?

【问题讨论】:

  • 嗨,你介意我问一下你的域标签是如何垂直的吗?
  • @NatalieCarr,我知道这有点晚了,但我是这样做的。在 XML 中,我使用了androidPlot.graphWidget.domainLabelOrientation="-90",或者在运行时使用plot.getGraphWidget().setDomainLabelOrientation(float)

标签: android graph androidplot android-graphview


【解决方案1】:

您可以做的一件事是设置正在绘制的标签的对齐方式。如果没记错的话,默认是居中对齐的,而您可能想要的是右对齐:

plot.getGraphWidget().getDomainLabelPaint().setTextAlign(Paint.Align.RIGHT);

尼克

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-10
    • 1970-01-01
    • 1970-01-01
    • 2010-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-03
    相关资源
    最近更新 更多