开发者

Jfreechart DateAxis should show date on the top of first tick unit

开发者 https://www.devze.com 2023-03-17 04:18 出处:网络
can anyone help me how I could display the date alone on top of the first tick unit of DateAxis in Jfreechart Gantt

can anyone help me how I could display the date alone on top of the first tick unit of DateAxis in Jfreechart Gantt

Like this:

6july|||7july|||8july|||

valueAxis.setTickUnit(new DateTickUnit(Da开发者_运维问答teTickUnit.HOUR,6)); ///what needs to be extended here to get the desired format as said above

valueAxis.setDateFormatOverride(new SimpleDateFormat("'|'d,MMM"));

Thank you.


Because a Gantt chart uses a DateAxis for the range, you can invoke setDateFormatOverride(), as shown here. Of course you'll want to use getRangeAxis().

Addendum: Reading more closely, you can use setLowerMargin() and/or setUpperMargin() on the range axis to leave some room for the date over the end ticks.

0

精彩评论

暂无评论...
验证码 换一张
取 消