Add(Value: IPPSpeedometerTrend): Integer;
Value. Trend to add.
The Add method adds a trend to the collection.
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, Express, Metabase, Speedometer system assemblies.
Sub UserProc;
Var
Speedometer: IPPSpeedometer;
MB: IMetabase;
AdhocReport: IAdhocReport;
EaxSpeedometer: IEaxSpeedometer;
Enalyzer: IEaxAnalyzer;
DsObjs: IAdhocDataSourceObjects;
Scales: IPPSpeedometerScales;
Scale: IPPSpeedometerScale;
Trends: IPPSpeedometerTrends;
Trend: IPPSpeedometerTrend;
Marker: IPPSpeedometerMarkerBase;
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 trends
Trends := Scale.Trends;
// Output the number of existing trends
Debug.WriteLine("Trends in collection before removal: " + Trends.Count.ToString);
// Remove all existing trends
Trends.RemoveAll;
// Create a new trend
Trend := New PPSpeedometerTrend.Create;
// Set trend value
Trend.Value := 15000;
// Set text displayed in trend text label
Trend.Label.Text := "The point of no return";
// Set copy of speedometer central marker as a trend marker
Marker := Speedometer.Center;
Trend.Marker := Marker;
// Add configured trend to collection
Trends.Add(Trend);
(Enalyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the console window displays size of the trends collection, after which the collection is cleared. A new trend is created, trend value, text, marker are set up. The new trend is added to the trends collection.
See also: