DataAdapter: Object;
The DataAdapter property determines an indicator data source.
Executing the example requires a form, a button named Button1 on the form, the UiMap component named UiMap1 that is a data source for the MapBox component. A map with the USA identifier must also be present in the repository. The VisualDataAdapter class implements a dynamic data source. The example is executed on clicking the button.
Var Count: Integer;
Class VisualDataAdapter: Object, IMapDynamicDataAdapter
Function Get_PartCount(Attribute: Variant; TimePoint: Integer): Integer;
Begin
Return Count;
End Function Get_PartCount;
Function Get_TimePointName(TimePoint: Integer): String;
Begin
Return "TimePoint " + TimePoint.ToString;
End Function Get_TimePointName;
Function Get_TimePointsCount: Integer;
Begin
Return 4;
End Function Get_TimePointsCount;
Function Get_Data(Attribute: Variant; PartvIndex: Integer; TimePoint: Integer): Variant;
Var t: Integer;
i: Integer;
Begin
t := 1;
For i := 0 To TimePoint Do
t := t + 10;
End For;
Return Math.Rand * 10 * t;
End Function Get_Data;
Function Get_CustomFormat: String;
Begin
Return "#0,000";
End Function Get_CustomFormat;
End Class VisualDataAdapter;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Map: IMap;
Layer: IMapLayer;
BarVisual: IMapBarVisual;
Begin
UiMap1.Map.Topobase := MetabaseClass.Active.ItemById("USA").Bind As IMapTopobase;
Map := UiMap1.Map;
Layer := Map.Layers.FindByName("Regions");
BarVisual := Layer.Visuals.AddBarVisual;
BarVisual.BeginUpdate;
BarVisual.DataAdapter := New VisualDataAdapter.Create As IMapDynamicDataAdapter;
BarVisual.AttributeName := "Id";
BarVisual.Name := "Bar0";
BarVisual.Width.Value := 4;
BarVisual.EndUpdate;
End Sub Button1OnClick;
After executing the example the bar indicator named Bar0 is added to the Regions layer.
See also: