ChartDirector 5.1 (PHP Edition)

phpchartdir.barLighting


Usage

barLighting([ startBrightness, endBrightness ])

Description

A special shading effect for rectangular and polygonal bars on a BarLayer. It shades all surfaces of a 2D or 3D bar with gradient colors.

For the front surface of a bar, the gradient is from base line of the bar to the end of the bar. For example, for a vertical bar pointing upwards, the gradient is from bottom to the top. Similarly, for a horizontal bar pointing rightwards, the gradient is from left to right.

For a 3D bar, the gradient for the top surface of a vertical bar or the right surface of a horizontal bar is from front to back. The gradients for the side surfaces are the same as for the front surface.

The gradient is specified with two brightness values at the gradient end points. A brightness less than 1 means the color is darkened, while a brightness greater than 1 means the color is brightened. For example, a brightness of 0.5 means the color is half as bright as the original color. If the original color is red, the color will become dark red. Conversely, a brightness of 2 means the color is twice as bright as the original color. If the original color is red, the color will become light red.

The followings are some examples demonstrating this effect.

ExampleDescription
Gradient Bar ChartA 2D horizontal bar chart using the barLighting effect, with the brightness at the end points being 0.75 and 2.0.
Gradient Multi-Bar ChartA 3D vertical bar chart using the barLighting effect, with the brightness at the end points being 0.75 and 1.75.

The barLighting method returns an integer representing this effect. The integer can be used as the second argument to Layer.setBorderColor for BarLayer objects to apply the effect to bars.

Arguments

ArgumentDefaultDescription
startBrightness0.75The brightness at the starting point.
endBrightness1.5The brightness at the ending point.

Return Value

An integer representing the bar lighting effect.