ChartDirector 6.0 (ASP/COM/VB Edition)

MeterPointer.setShape2

Usage

setShape2(pointerCoor [, lengthRatio [, widthRatio ]])

Description

Sets the shape of the meter pointer to a custom polygon.

**Note:** For angular meters, this method is for classical style pointers. There is another method MeterPointer.setShapeAndOffset2 for setting the shapes and positions of new style pointers.

The custom polygon is specified as a list of numbers representing the (x, y) coordinates of the polygon vertices.

For an angular meter, the polygon should be defined with a nominal dimension of 1000 units. ChartDirector will scale the polygon so that 1000 units will become the radius of the meter.

For a linear meter, the length of the pointer should be defined with a nominal dimension of 1000 units. ChartDirector will scale the polygon so that 1000 units will be the length required for the pointer to reach the meter scale. The width of the pointer will be in 0.1 pixel units (that is, 10 units = 1 pixel).

The coordinate system for defining the polygon is that the x-axis points from left to right, and the y-axis points from bottom to top. The polygon will be defined as a pointer with the pivot at the origin, pointing to the upward direction.

As an example, the coordinates of the standard diamond pointer for an angular meter are:

The coordinates for the standard pencil pointer for a linear meter are:

After scaling the pointers based on the nominal units, ChartDirector will applies the**lengthRatio** and **widthRatio** scaling factor to the pointer. These ratios allow you to change the pointer sizes without changing the polygon definition. For example, if you want the meter pointer to be only 80% of the radius in the angular meter, you can set the lengthRatio to 0.80.

The custom polygon is specified as a list of numbers representing the (x, y) coordinates of the polygon vertices.

For an angular meter, the polygon should be defined with a nominal dimension of 1000 units. ChartDirector will scale the polygon so that 1000 units will become the radius of the meter.

For a linear meter, the length of the pointer should be defined with a nominal dimension of 1000 units. ChartDirector will scale the polygon so that 1000 units will be the length required for the pointer to reach the meter scale. The width of the pointer will be in 0.1 pixel units (that is, 10 units = 1 pixel).

The coordinate system for defining the polygon is that the x-axis points from left to right, and the y-axis points from bottom to top. The polygon will be defined as a pointer with the pivot at the origin, pointing to the upward direction.

As an example, the coordinates of the standard diamond pointer for an angular meter are:

0, -100, -50, -50, 0, 1000, 50, -50

The coordinates for the standard pencil pointer for a linear meter are:

-30, 0, 30, 0, 30, 768, 0, 1000, -30, 768

After scaling the pointers based on the nominal units, ChartDirector will applies the

Arguments

Argument | Default | Description |
---|---|---|

pointerCoor | (Mandatory) | An array of numbers x0, y0, x1, y1, x2, y2, ..., representing the coordinates the polygon vertices. |

lengthRatio | NoValue | The length ratio to be applied to the pointer. NoValue means the lengthRatio is not modified. The default is 1.0 for angular meters and 0.75 for linear meters. |

widthRatio | NoValue | The width ratio to be applied to the pointer. NoValue means the widthRatio is not modified. The default is 1.0. |

Return Value

None

© 2017 Advanced Software Engineering Limited. All rights reserved.