Resize Vertical Tick Label Height (XYStepChart)

前端 未结 1 1733
感情败类
感情败类 2020-11-30 15:34

I\'ve got the following chart made with JFreeChart:

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-201

相关标签:
1条回答
  • 2020-11-30 16:12

    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));
    
    0 讨论(0)
提交回复
热议问题