Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 添加第二个Y轴标题,标记线+;添加行标题_Android_Androidplot - Fatal编程技术网

Android 添加第二个Y轴标题,标记线+;添加行标题

Android 添加第二个Y轴标题,标记线+;添加行标题,android,androidplot,Android,Androidplot,我有以下问题 我想: 在右侧的我的Android绘图中添加第二个轴标题 和右边一样的标签。(可能) 用颜色和一些文字标记一行 紫色线应始终位于黄色线的前面 有没有办法做到这一点 因为一张图片可以表达上千个单词 没有内置的第二轴标题,但由于它们只是TextLabelWidget的实例,因此添加自己的标题非常容易。下面是一个向SimpleXYPlotActivity示例添加标签的示例 TextLabelWidget textLabelWidget = new TextLabelWidge

我有以下问题

我想:

  • 在右侧的我的Android绘图中添加第二个轴标题
  • 和右边一样的标签。(可能)
  • 用颜色和一些文字标记一行
  • 紫色线应始终位于黄色线的前面
有没有办法做到这一点

因为一张图片可以表达上千个单词


没有内置的第二轴标题,但由于它们只是
TextLabelWidget
的实例,因此添加自己的标题非常容易。下面是一个向
SimpleXYPlotActivity
示例添加标签的示例

    TextLabelWidget textLabelWidget = new TextLabelWidget(
            plot.getLayoutManager(),
            "some text",
            null,  // TextLabelWidget instances "pack" to wrap the actual text size
            TextOrientation.VERTICAL_ASCENDING);

    textLabelWidget.getLabelPaint().setColor(Color.RED);
    textLabelWidget.getLabelPaint().setTextSize(PixelUtils.dpToPix(24));

    plot.getLayoutManager().add(textLabelWidget);
    textLabelWidget.position(
            // add a right margin of 4dp:
            PixelUtils.dpToPix(4), HorizontalPositioning.ABSOLUTE_FROM_RIGHT,

            // center the text with the plot space vertically:
            0, VerticalPositioning.ABSOLUTE_FROM_CENTER,

            // use the middle of the right edge of the text widget as the anchor:
            Anchor.RIGHT_MIDDLE);
产生:


是否也可以在第二轴上添加标签?对不起,我没有注意到这里有多个问题。根据SOF的规则,最好编辑此问题并为其他问题创建单独的问题。在任何情况下,您都可以在xml中显示任意多条或任意少条边的标签,如下所示:
ap:lineLabels=“left | bottom | top | right”
好的,我下次会记得它。我也可以通过methodecall设置ap:lineLabels吗?您可以:
plot.getGraph().setLineLabelEdges(XYGraphWidget.Edge.bottom,XYGraphWidget.Edge.right)