在jFreeChart中设置垂直轴标签的货币格式 [英] Setting currency format for labels of vertical axis in jFreeChart

查看:181
本文介绍了在jFreeChart中设置垂直轴标签的货币格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



更多详细信息:我有时间系列图表,纵轴应具有货币格式的标签,例如

  $ 100,000 000 
$ 50 000


现在我有相同的标签,但没有美元符号和范围分隔符。

对于水平轴,我使用了这种方法:

$ $ $ $ $ $ $ $ $ DateAxis axis =(DateAxis)plot.getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat(yyyy));

它可以工作。

当我尝试做类似的事情

ValueAxis valueAxis =(ValueAxis)plot.getRangeAxis();

我不能找到任何方法来格式化标签。



请帮助我。 ChartFactory.createTimeSeriesChart()工厂提供了一个<$ c

解决方案 $ c> NumberAxis ,因此您可以使用 setNumberFormatOverride()与本地货币格式化程序配合使用,如这里


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.

解决方案

The ChartFactory.createTimeSeriesChart() factory supplies a NumberAxis for the range, so you can use setNumberFormatOverride() for with a localized currency formatter, as shown here.

这篇关于在jFreeChart中设置垂直轴标签的货币格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆