| | | | Browse by category |
Question
How can I customize the way time units are displayed on the scale axis?
Answer
Predefined time units are singleton instances of hidden classes. To change the date format, create an IlvTimeUnit
instance that delegates to a predefined unit and overrides the getFormatString()
method.
To do this:
IlvTimeUnit unit = new IlvMultipleTimeUnit(IlvTimeUnit.DAY, 1) {
public String getFormatString() {
return "dd-MMM-yy";
}
};
Everything but the date formatting will be delegated to IlvTimeUnit.DAY
.To know what kind of string can be returned by the getFormatString
method, please give a look at the Java documentation for the class SimpleDateFormat.. It describes in details the different patterns that can be used for displaying dates.
Alternatively, if you want the modification to impact the whole application, you can edit the contents of the resource file used by the IlvTimeUnit
class.