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.
精彩评论