IPPSpeedometerSectors.Add

Syntax

Add(Value: IPPSpeedometerSector): Integer;

Parameters

Value. Added sector.

Description

The Add method adds a sector to the collection.

Example

Executing the example requires that the repository contains a database with the ADHOC identifier. A dashboard must contain a speedometer.

Add links to the Adhoc, Drawing, Express, Metabase, Speedometer system assemblies.

Sub UserProc;
Var
    Speedometer: IPPSpeedometer;
    MB: IMetabase;
    AdhocReport: IAdhocReport;
    EaxSpeedometer: IEaxSpeedometer;
    Enalyzer: IEaxAnalyzer;
    DsObjs: IAdhocDataSourceObjects;
    Scales: IPPSpeedometerScales;
    Scale: IPPSpeedometerScale;
    Sectors: IPPSpeedometerSectors;
    Sector: IPPSpeedometerSector;
    SolidBrush: IGxSolidBrush;
    Color: IGxColor;
Begin
    MB := MetabaseClass.Active;
    // Get dashboard 
    AdhocReport := MB.ItemById("ADHOC").Edit As IAdhocReport;
    // Get dashboard data sources
    DsObjs := AdhocReport.DataSourceObjects;
    // Get speedometer
    Enalyzer := DsObjs.Item(0).GetSourceObject As IEaxAnalyzer;
    EaxSpeedometer := Enalyzer.Speedometer;
    // Get speedometer parameters
    Speedometer := EaxSpeedometer.Speedometer;
    // Get collection of speedometer scales
    Scales := Speedometer.Scales;
    // Get data scale
    Scale := Scales.DataScale;
    // Get collection of scale sectors
    Sectors := Scale.Sectors;
    // Display size of sectors collection
    Debug.WriteLine("Sectors before removal: " + Sectors.Count.ToString);
    // Clear collection of sectors
    Sectors.RemoveAll;
    // Create a new sector
    Sector := New PPSpeedometerSector.Create;
    // Set sector start and end values
    Sector.StartValue := 15000;
    Sector.EndValue := 20000;
    // Set sector start and end width
    Sector.StartSize := 20;
    Sector.EndSize := 60;
    // Determine offset measurement unit  - percents
    Scale.IsAbsoluteSectorOffset := False;
    // Set sector offset
    Sector.Offset := 0.1;
    // Set up sector background fill color
    Sector.EnableBrush := True;
    Color := New GxColor.CreateRGB(0,255,0);
    SolidBrush := New GxSolidBrush.Create(Color);
    Sector.Background := SolidBrush;
    // Add a new sector to collection
    Sectors.Add(Sector);
    (Enalyzer As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the console window displays the size of the sectors collection. The sectors collection is cleared, after which a new sector is created, set up and added to the collection.

See also:

IPPSpeedometerSectors