问题
The essential of question is declared at the title.
More details: I have the Time series chart, and vertical axis should has labels in currency format like this
$100, 000, 000
$50, 000
...
Now I have the same labels, but without dollar sign and range delimiter.
For horizontal axis I used this approach:
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat("yyyy"));
And it works.
When I try to do similar
ValueAxis valueAxis = (ValueAxis) plot.getRangeAxis();
I can't find any method to format labels.
Please, help me.
回答1:
The ChartFactory.createTimeSeriesChart()
factory supplies a NumberAxis
for the range, so you can use setNumberFormatOverride()
for with a localized currency formatter, as shown here.
来源:https://stackoverflow.com/questions/15254385/setting-currency-format-for-labels-of-vertical-axis-in-jfreechart