`[C#] ` | `public int relativeLinearGradient(double[] gradient [, double angle [, double radius ]]);` |

`[VB] ` | `Public Function relativeLinearGradient(gradient As Double() [, angle As Double [, radius As Double ]]) As Integer` |

ChartDirector 6.2 (.NET Edition)

AngularMeter.relativeLinearGradient

Usage

`[C#] ` | `public int relativeLinearGradient(double[] gradient [, double angle [, double radius ]]);` |

`[VB] ` | `Public Function relativeLinearGradient(gradient As Double() [, angle As Double [, radius As Double ]]) As Integer` |

Description

Creates a linear gradient color relative to the meter center and radius.

A general linear gradient color can be created by BaseChart.linearGradientColor2, which involves specifying the x and y coordinates of the starting and ending points and the color stops. The**relativeLinearGradient** simplifies creating a linear gradient by assuming the gradient line passes through the meter center at an configurable angle.

The linear gradient is defined using an array of numbers, in which each pair of numbers represents the relative distance and its associated color. The relative distance is the ratio of the absolute distance to the reference radius, which defaults to the meter scale radius (set by AngularMeter.setMeter).

For example, to define a linear gradient with blue (0000FF) at the bottom-left of reference radius, green (00FF00) at the center, and red (FF0000) at the top-right of the reference radius, the angle should be set to 45 degrees, and the array of numbers should be:

**Note**: The above hexadecimal numbers are based on C# syntax. For VB.NET, instead of using "0x", please use "&H" as the prefix for hexadecimal numbers.

The relative distances in the array should be arranged in increasing order. It is possible to define a relative linear gradient shorter or longer than the reference radius by using a relative distance of magnitude smaller or greater than 1. A negative relative distance means the distance is measured at the opposite side of center.

A general linear gradient color can be created by BaseChart.linearGradientColor2, which involves specifying the x and y coordinates of the starting and ending points and the color stops. The

The linear gradient is defined using an array of numbers, in which each pair of numbers represents the relative distance and its associated color. The relative distance is the ratio of the absolute distance to the reference radius, which defaults to the meter scale radius (set by AngularMeter.setMeter).

For example, to define a linear gradient with blue (0000FF) at the bottom-left of reference radius, green (00FF00) at the center, and red (FF0000) at the top-right of the reference radius, the angle should be set to 45 degrees, and the array of numbers should be:

-1.0, 0x0000ff, 0.0, 0x00ff00, 1.0, 0xff0000

The relative distances in the array should be arranged in increasing order. It is possible to define a relative linear gradient shorter or longer than the reference radius by using a relative distance of magnitude smaller or greater than 1. A negative relative distance means the distance is measured at the opposite side of center.

Arguments

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

gradient | (Mandatory) | An numeric array defining the color stops. Please refer to the description above for details. |

angle | 0 | The direction of the linear gradient line. It is specified as a clockwise angle in degrees, with 0 being the upward pointing direction. |

radius | -1 | The reference radius to define the relative distance. The default is the meter scale radius (set by AngularMeter.setMeter). |

Return Value

A 32-bit integer representing the linear gradient color.

© 2017 Advanced Software Engineering Limited. All rights reserved.