问题描述
我已经使用JFreeChart制作了以下图表:
I've got the following chart made with JFreeChart:alt text http://img706.imageshack.us/img706/912/jfreechart.jpg
是否有可能(如果是这样的话)延长日期在x轴上,以便它们包含年份,例如。 4-II-2010,5-II-2010,...,6-III-2010?
Is it possible (and if it is how) to extend the dates on the x-axis so that they contain the year, eg. 4-II-2010, 5-II-2010, ..., 6-III-2010?
推荐答案
目前尚不清楚你现在如何格式化日期,但 /jfree/chart/axis/DateAxis.html\"rel =nofollow noreferrer> DateAxis
允许您指定合适的。如果尚未提供,您应该能够覆盖 /text/DateFormatSymbols.htmlrel =nofollow noreferrer> DateFormatSymbols
罗马数字。
It's not clear how you are formatting the dates now, but setDateFormatOverride
in DateAxis
allows you to specify a suitable SimpleDateFormat
. If not already available, you should be able to override getShortMonths()
in DateFormatSymbols
for the Roman numerals.
附录:为了正确本地化,可能更容易做到这样的事情:
Addendum: For correct localization, it may be easier to do something like this:
DateAxis axis = (DateAxis) plot.getDomainAxis();
DateFormatSymbols dfs = DateFormatSymbols.getInstance(); // default locale
String[] roman = { ... };
dfs.setShortMonths(roman);
axis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy", dfs));
这篇关于调整垂直刻度线标签高度(XYStepChart)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!