ChartDirector 7.0 (Python Edition)

SplineLayer.setMonotonicity


Usage

setMonotonicity(monotonicMode)

Description

Sets the monotonicity constraint when computing the spline curve.

Monotonicity means a sequence is increasing or decreasing in one direction. For example, the sequence 1, 2, 3, 4 is monotonically increasing, while the sequence 1, 3, 2, 5, 4 is not monotonic.

A standard spline curve can overshoot or undershoot if the underlying points have "sharp corners". That means without any constrain, even if the data points are monotonic, the spline curve joining the points is not necessarily monotonic. It can overshoot and then "fall back".

In many charts, it may be desirable to constraint the spline curve to flow in a certain direction. For example, in a time based chart, it may be desirable to constraint the curve always flow from left to right.

ChartDirector supports the following monotonic modes.

ConstantValueDescription
MonotonicNone0The spline curve is not constraint to flow in any direction. This results in the smoothest spline curve.
MonotonicX1The spline curve is constraint to not overshooting or undershooting in the x-axis direction. This means if the data points are monotonic in the x-axis direction, the spline curve will also be monotonic in the x-axis direction.
MonotonicY2The spline curve is constraint to not overshooting or undershooting in the y-axis direction. This means if the data points are monotonic in the y-axis direction, the spline curve will also be monotonic in the y-axis direction.
MonotonicXY3The spline curve is constraint to not overshooting or undershooting in both the x-axis and the y-axis directions. This means if the data points are monotonic in the x-axis direction, the spline curve will also be monotonic in the x-axis direction. If the data points are monotonic in the y-axis direction, the spline curve will also be monotonic in the y-axis direction.
MonotonicAuto4Automatically choose between MonotonicX, MonotonicY or MonotonicXY, depending on whether the data points are monotonic in the x-axis direction, or y-axis direction, or both.

Arguments

ArgumentDefaultDescription
monotonicMode(Mandatory)The monotonic constraint of the spline curve. Must be be one of the constants in the above table. If this method is never called for a spline layer, the default is MonotonicAuto.

Return Value

None