Sets multiple formats for numeric or date/time axis labels.
This method is typically used to format date/time labels. For example, for an axis that spans 90 days, this method can be used to format the first labels of each month in bold as "mmm-dd", while other labels are shown in normal font as "dd".
The multiple formats are defined as a list of filters and format strings. If the label value satisfies the first filter, it will be formatted using the first format string. Otherwise if the label value satisfies the second filter, it will be formatted using the second format string, and so on. If a label value does not satisfy any filter, it will be discarded.
In the above example, the first filter can be a "start of month" filter (created using
Chart.StartOfMonthFilter), and the first format string can be "{value|mmm-dd}". The second filter can be the "all pass" filter (created using
Chart.AllPassFilter), and the format string can be "{value|dd}".
Supported filters in ChartDirector include:
For the format strings, please refer to
Parameter Substitution and Formatting on their syntax.
A single setMultiFormat method supports two filters and two format strings. You can use multiple setMultiFormat and/or
Axis.setMultiFormat2 methods to add more filters and format strings.
One common issue in putting labels on the axis is that there may be too many labels on the axis. The setMultiFormat method supports a
labelSpan argument that specifies how many label positions a single label will occupy. If a label occupies more than 1 position, ChartDirector will not put labels on nearby positions, even if they meet the filter criteria.
The setMultiFormat method supports special handling of the first label on the axis. For example, in the above example, we may want to show the the first label as "mmm-dd", even if it is not actually the "start of month". The
promoteFirst argument, if set to true, will cause the first label to be promoted to a higher filter category in the multi-format list. For example, if the first label satisfies only the second filter, it will be formatted as if it satisfies the first filter.
© 2012 Advanced Software Engineering Limited. All rights reserved.