Count: Integer;
Count: integer;
The Count property returns the size of the text labels 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, 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;
Labels: IPPSpeedometerLabels;
Color: IGxColor;
Font: IGxFont;
i: Integer;
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 text labels of data scale
Labels := Scale.Labels;
// Output collection elements
For i := 0 To Labels.Count - 1 Do
Debug.WriteLine(Labels.Item(i).Text);
End For;
// Add a text label
Labels.Add("New label");
// Set up font size of the text displayed in text labels
Font := New GxFont.Create("Arial",12);
Labels.Font := Font;
// Set up text color
Color := New GxColor.CreateRGB(0,255,255);
Labels.FontColor := Color;
(Enalyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the console window displays the text located in text labels of data scale. A new text label is added. Text font and color are set up for all text labels.
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;
Imports Prognoz.Platform.Interop.Drawing;
…
Public Shared Sub Main(Params: StartParams);
Var
Speedometer: IPPSpeedometer;
MB: IMetabase;
AdhocReport: IAdhocReport;
EaxSpeedometer: IEaxSpeedometer;
Enalyzer: IEaxAnalyzer;
DsObjs: IAdhocDataSourceObjects;
Scales: IPPSpeedometerScales;
Scale: PPSpeedometerScale;
Labels: IPPSpeedometerLabels;
Color: GxColorClass;
BrushColor: GxColor;
Font: GxFont;
i: Integer;
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 text labels of data scale
Labels := Scale.Labels;
// Output collection elements
For i := 0 To Labels.Count - 1 Do
System.Diagnostics.Debug.WriteLine(Labels.Item[i].Text);
End For;
// Add a text label
Labels.Add("New label");
// Set up font size of the text displayed in text labels
Font := New GxFontClass();
Font.Create("Arial",12,GxFontStyle.gfsBold,GxUnit.guPoint);
Labels.Font := Font;
// Set up text color
Color := New GxColorClassClass();
BrushColor := Color.FromKnownColor(GxKnownColor.clBlue);
Labels.FontColor := BrushColor;
(Enalyzer As IMetabaseObject).Save();
End Sub;
See also:
Related work items
Requirement