线性 y 轴上的指数刻度 - JFreeChart
Exponential tick on linear yAxis - JFreeChart
我有一张像这样的对数 yAxis 图表:
正如我们所见,yAxis 具有指数刻度(我用 yAxis.setExpTickLabelsFlag(true);
设置了它)。这是带有线性轴的同一张图表(创建 xylineChart
时的默认图表):
不幸的是,我在 yAxis 上的值不能用指数刻度格式化,因为它不是 LogarithmicAxis
。我怎样才能强迫它?
如图, you can invoke setNumberFormatOverride()
to set the desired DecimalFormat
. You can invoke the setExponentSeparator()
method of DecimalFormatSymbols
设置所需的指数分隔符。
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setExponentSeparator("e");
DecimalFormat format = new DecimalFormat("0.######E0", symbols);
yAxis.setNumberFormatOverride(format);
或者,你应该可以修改numberFormatterObj
of LogarithmicAxis
in a custom implementation of setupNumberFmtObj()
, seen here,但我没有试过。
我有一张像这样的对数 yAxis 图表:
正如我们所见,yAxis 具有指数刻度(我用 yAxis.setExpTickLabelsFlag(true);
设置了它)。这是带有线性轴的同一张图表(创建 xylineChart
时的默认图表):
不幸的是,我在 yAxis 上的值不能用指数刻度格式化,因为它不是 LogarithmicAxis
。我怎样才能强迫它?
如图setNumberFormatOverride()
to set the desired DecimalFormat
. You can invoke the setExponentSeparator()
method of DecimalFormatSymbols
设置所需的指数分隔符。
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setExponentSeparator("e");
DecimalFormat format = new DecimalFormat("0.######E0", symbols);
yAxis.setNumberFormatOverride(format);
或者,你应该可以修改numberFormatterObj
of LogarithmicAxis
in a custom implementation of setupNumberFmtObj()
, seen here,但我没有试过。