AddData (Dundas Pie Chart Server 1.0)

Dundas

AddData

Overview | Properties | Methods

Call this method to add data elements (slices) to a pie chart.

Syntax

long = PieChartObject.AddData(Value As Double, [DataLabel As String], [Color As Long =&HFFFFFF], [Texture As String])

The AddData method syntax has the following parts:

Part

Description

Value

The size of the pie chart slice (element).

DataLabel

The label of the pie slice. If this is not set then your resulting jpeg will not have pie slice labels.

LegendLabel

The legend title of the pie slice. If this is not set then your resulting jpeg will not have labels (text) for the legend.

Color

The color of the pie slice (defaults to white). Use either a hexadecimal value or VBScript's RGB function.

Texture

The texture of the pie slice.

long

Returns a long indicating the success or failure of the operation. Zero (0) is returned if successful, otherwise a non-zero value is returned.

 
Returns

A long which indicates the success/failure of the operation. Zero (0) is returned if successful, otherwise a non-zero value is returned. If an error occurs you can use this return value as the argument for GetErrorText in order to retrieve a relevant text error message, or alternatively you can rem out the "On Error Resume Next" statement and observe the thrown exception for a description of the error.

Remarks

The size of the pie slice is dictated by the Data argument. The size is not in any specific units (e.g. degrees or radians), rather it is represented as a percentage of the total number of specified sizes. For example, if there are four slices and they all have a Data value of 10 then their individual sizes will be: (10/(10 + 10 + 10 + 10)) * 100%.

If you do not specify a color or texture for an element then the color or texture for that particular element will be obtained from the loaded template (if it exists). If the same element does not exist in the template then the default color is white and the texture is set to "none". For example, assume we have loaded a template which contains four (4) pie slices. If we add pie slice #1 with AddData and we do not specify a color or texture then the color and texture for pie element #1 in the template will be used. If, however, we add pie element #5 without specifying a color or texture then there will be no texture used and the color of the pie slice will be white since the template we loaded does not have a fifth pie slice.

To set the Color argument you can use either a hexadecimal value or VBScript's RGB function.

Please note that a template only provides textures and colors for pie slices. You MUST SPECIFY the pie slice labels and legend labels if you want to display them in your jpeg.

IMPORTANT: You MUST load the desired template BEFORE calling AddData, otherwise values set in the AddData call will be overwritten by the pie chart attributes stored in the template.

See Also: LoadTemplate | Overview (Dundas Pie Chart Server Control)