ChartDirector 7.0 (Python Edition)

Axis.setFormatCondition


Usage

setFormatCondition(condition [, operand ])

Description

Specifies the condition that subsequent Axis.setLabelFormat and Axis.setMultiFormat will become applicable.

In some applications, the axis range can vary greatly. For example, for a date/time axis, the ticks on the axis can be hourly ticks if the duration is short, or daily ticks (or even monthly or yearly) if the duration is long. One can always use a universal axis format that is applicable in all cases (such as "mmm dd, yyyy<*br*>hh:nn:ss"), or one can leave ChartDirector to automatically come up with a suitable axis format.

Sometimes it may be desirable to explicitly specify different axis formats depending on tick types. For example, one may want to specify a certain format if the ticks are hourly, and another format if the ticks are daily.

If it is possible to predict which kind of ticks will be on the axis, one can always use "if" statements to specify different axis formats for various cases.

The setFormatCondition method is for cases in which it is difficult to predict which type of ticks would appear on the axis. For example, in an auto-scaled axis in which the duration can vary continuously, in some marginal cases, it is difficult to predict if auto-scaling will choose hourly or daily ticks.

The setFormatCondition method allows you to specify a condition to be tested against the auto-scaling result, so that subsequent Axis.setLabelFormat or Axis.setMultiFormat will be applicable only if the condition is true.

The types of condition supported are:

ConditionDescription
"align" Test if all the ticks are aligned to the operand. Use 3600 for testing hourly alignment, 86400 (1 day = 86400) for daily alignment, 30 * 86400 for monthly alignment and 360 * 86400 for yearly alignment. (Note: The values for monthly and yearly alignments are special values recognized by ChartDirector. They works even if a month or year is not exactly 30 or 360 days.)
">" Test if the maximum absolute value of the ticks are larger than the operand. This is useful when one needs to apply different formats to large numbers (eg. use scientific formats if the axis range exceed certain values).
">=" Test if the maximum absolute value of the ticks is larger than or equal to the operand.
"<" Test if the maximum absolute value of the ticks is less than the operand.
"<=" Test if the maximum absolute value of the ticks is less than or equal to the operand.
"==" Test if the maximum absolute value of the ticks is equal to the operand.
"=" Same as "==" above.
"!=" Test if the maximum absolute value of the ticks is not equal to the operand.
"<>" Same as "!=" above.
"else" This condition is true if and only if the previous condition is false.
"true" This condition is always true. It is useful as a "catch all" condition.
"false" This condition is always false.

Arguments

ArgumentDefaultDescription
condition(Mandatory)The type of condition to test. Must be one of the condition types in the above table. This text string is case sensitive.
operand0The operand for condition types that need an operand.

Return Value

None