Scale units customization

Article ID: 2225
Last updated: 29 May, 2018
Article ID: 2225
Last updated: 29 May, 2018
Revision: 3
Views: 653
Posted: 26 Oct, 2007
by Dean J.
Updated: 29 May, 2018
by Gargani A.

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.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2225
Last updated: 29 May, 2018
Revision: 3
Views: 653
Posted: 26 Oct, 2007 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category