Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

GraphOptions Properties

GraphOptions BarDirection property

Declaration

property BarDirection: TCrBarDirection;

Type

TCrBarDirection = (bdHorizontal, bdVertical, bdDefault);

Description

The BarDirection property specifies the direction of the bars in a Bar Graph. These can be either vertical or horizontal.

Example

The following code illustrates the use of the GraphOptions BarDirection property:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GraphOptions.Retrieve;

if Crpe1.GraphOptions.Count > 0 then Crpe1.GraphOptions[0].BarDirection := bdHorizontal;

Crpe1.Output := toWindow; Crpe1.Execute;

GraphOptions DataValues property

Declaration

property DataValues: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The DataValues property specifies whether or not the numeric value associated with each Riser on the Graph will be displayed. If set to cTrue, a value appears in the Graph for each Riser.

VCL Reference

314

Example

The following code illustrates the use of the GraphOptions DataValues property:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GraphOptions.Retrieve;

if Crpe1.GraphOptions.Count > 0 then Crpe1.GraphOptions[0].DataValues := cTrue;

Crpe1.Output := toWindow; Crpe1.Execute;

GraphOptions Font property

Declaration

property Font: TFontName;

Description

The Font property specifies the font for all text and values in the Graph. The property uses Delphi's TFontName type, which makes a list of installed fonts available on the Object Inspector (or if the property is double-clicked, the Font Dialog will appear).

Example

The following code illustrates the use of the GraphOptions Font property:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GraphOptions.Retrieve;

if Crpe1.GraphOptions.Count > 0 then Crpe1.GraphOptions[0].Font := 'Times New Roman';

Crpe1.Output := toWindow; Crpe1.Execute;

GraphOptions GridLines property

Declaration

property GridLines: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

VCL Reference

315

Description

The GridLines property specifies whether or not to display Grid Lines on the Graph. If the property is set to cTrue, Grid Lines will be visible.

Example

The following code illustrates the use of the GraphOptions GridLines property:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GraphOptions.Retrieve;

if Crpe1.GraphOptions.Count > 0 then Crpe1.GraphOptions[0].GridLines := cTrue;

Crpe1.Output := toWindow; Crpe1.Execute;

GraphOptions Item property

Declaration

property Item[const nIndex: integer]: TCrpeGraphOptions;

Description

The Item property is a default array property. It is read-only, and only available at runtime. It's primary use is to provide an easy way to navigate through the various items stored in the GraphOptions object, allowing the object to be treated like an array.

Item is a default property, so it does not need to be specified when using the subscript: GraphOptions[2] is the same as GraphOptions.Item[2].

Item returns a reference to itself, so the GraphOptions properties can be used right after the subscript: GraphOptions[2].Min := 2000;

Example

Since Item is a default array property, the following two blocks of code do the same thing:

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.GraphOptions.Retrieve;

{Set GraphOptions object to the 2nd graph} Crpe1.GraphOptions.Item[1];

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.GraphOptions.Retrieve;

{Set GraphOptions object to the 2nd graph} Crpe1.GraphOptions[1];

VCL Reference

316

GraphOptions ItemIndex property

Declaration

property ItemIndex: integer;

Description

ItemIndex is a Run-time only property which can be used to obtain the current GraphOptions item number, or set the GraphOptions object to another item.

Each object in the Crystal component that can contain more than one item uses an internal Index to maintain which item it is currently looking at, similar to the ItemIndex property of a ListBox. This Index is updated whenever the Item property is used (GraphOptions[2], for example), or whenever the key property (if applicable) is assigned a new lookup value (key properties are things like Formulas.Name, or SortFields.Number which serve as look-up properties).

The easiest way to read the current Index number is to use the ItemIndex property.

Example

The following code illustrates the use of the ItemIndex property to make sure the GraphOptions object is pointing to the first GraphOptions item:

if Crpe1.GraphOptions.ItemIndex <> 0 then Crpe1.GraphOptions[0];

GraphOptions Legend property

Declaration

property Legend: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The Legend property specifies whether or not to display the Graph Legend. If the property is set to cTrue, the Legend will be visible.

VCL Reference

317

Соседние файлы в папке crystal