调整垂直刻度线标签高度(XYStepChart) [英] Resize Vertical Tick Label Height (XYStepChart)

查看:114
本文介绍了调整垂直刻度线标签高度(XYStepChart)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用JFreeChart制作了以下图表:
alt text http://img706.imageshack.us/img706/912/jfreechart.jpg

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?

推荐答案

目前尚不清楚你现在如何格式化日期,但 setDateFormatOverride /jfree/chart/axis/DateAxis.html\"rel =nofollow noreferrer> DateAxis 允许您指定合适的 SimpleDateFormat 。如果尚未提供,您应该能够覆盖 getShortMonths() /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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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