Add(Value: IPPSpeedometerTrend): Integer;
Add(Value: Prognoz.Platform.Interop.Speedometer.PPSpeedometerTrend): 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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.AdHoc;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Speedometer;
…
Public Shared Sub Main(Params: StartParams);
Var
Speedometer: IPPSpeedometer;
MB: IMetabase;
AdhocReport: IAdhocReport;
EaxSpeedometer: IEaxSpeedometer;
Enalyzer: IEaxAnalyzer;
DsObjs: IAdhocDataSourceObjects;
Scales: IPPSpeedometerScales;
Scale: PPSpeedometerScale;
Trends: IPPSpeedometerTrends;
Trend: IPPSpeedometerTrend;
Marker: IPPSpeedometerMarkerBase;
Begin
MB := Params.Metabase;
// 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;
// Display the number of existing labels
System.Diagnostics.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 As PPSpeedometerMarker;
// Add configured trend to collection
Trends.Add(Trend As PPSpeedometerTrend);
(Enalyzer As IMetabaseObject).Save();
End Sub;
See also:
Related work items
Requirement