轴说明中的下标

贝娜莎·塔希提(Benaissa Tahiti)

我想知道是否可以在轴说明中使用下标。我有以下代码

    XYItemRenderer lineYY = new StandardXYItemRenderer();
    lineYY.setSeriesPaint(0, Color.BLUE);
    lineYY.setSeriesVisibleInLegend(0,false);
    final NumberAxis yaxY = new NumberAxis("ax [m/s²]");
    yaxY.setRange(-11, 11);
    yaxY.setAutoRangeIncludesZero(false);
    XYPlot plotYY = new XYPlot(datasetY,null,yaxY, lineYY);
    plotYY.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

是否可以在字符串“ a x [m /s²]”中对x下标下标为例如X₉

垃圾神

使用此处显示的方法,可以AttributedString为所需的轴标签指定一个给定一个NumberAxisnamed domain,下面的示例使用TextAttribute值更改某些字符SIZEWEIGHT,在第二个字符下标并在指数上标。

String s = "ax [m/s2]";
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.SIZE, 24, 0, 2);
as.addAttribute(TextAttribute.SIZE, 16, 3, 9);
as.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, 0, 2);
as.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB, 1, 2);
as.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 7, 8);
domain.setAttributedLabel(as);

图片

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章