Add(Value: IVZMapChartArrow): Integer;
Add(Value: Prognoz.Platform.Interop.Visualizators.VZMapChartArrow): integer;
Value. Map arrow.
The Add method adds an arrow to the collection.
To clear the arrow collection, use IVZMapChartArrows.Clear.
To remove arrow from the collection by its index, use IVZMapChartArrows.Remove.
Executing the example requires that the repository contains an express report with the EXPRESS identifier containing a map with arrows.
Add links to the Drawing, Express, Metabase, Visualizators system assemblies.
Sub UserProc;
Var
Metabase: IMetabase;
EaxAnalyzer: IEaxAnalyzer;
Map: IVZMapChart;
Arrows: IVZMapChartArrows;
Arrow: IVZMapChartArrow;
ArrowStyle: IVZMapChartArrowStyle;
Color: IGxColor;
Pen: IGxPenBase;
LabelStyle: IVZLabelStyle;
Brush: IGxBrush;
Font: IGxFontBase;
TtStyle: IVZToolTipStyle;
AV: IVZMapChartArrowVisual;
Begin
// Get repository
Metabase := MetabaseClass.Active;
// Get express report
EaxAnalyzer := Metabase.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get express report map
Map := EaxAnalyzer.MapChart.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow := Arrows.Item(0);
Arrows.Clear;
Arrows.Add(Arrow);
// Change identifier, arrow entry and exit points
Arrow.ArrowId := "ArrowID";
Arrow.StartShapeId := Map.RootLayer.SubLayers.Item(0).Shapes.Item(10).ShapeId;
Arrow.EndShapeId := Map.RootLayer.SubLayers.Item(0).Shapes.Item(30).ShapeId;
// Get default arrow style and change it
ArrowStyle := Map.DefaultArrowStyle;
// Change arrow bend angle
ArrowStyle.Angle := 45;
// Change arrow type to shaped
ArrowStyle.ArrowType := MapChartArrowType.Figured;
// Arrow head size does not depend on its length
If ArrowStyle.IsRelativeWidth Then
ArrowStyle.IsRelativeWidth := False;
End If;
// Arrow head size
ArrowStyle.PointerLength := 30;
ArrowStyle.PointerWidth := 30;
// Change arrow label position by entire length
ArrowStyle.TextOrientation := MapChartArrowTextOrientation.AlongTheArrow;
// Create arrow border
Color := New GxColor.CreateRGB(0, 0, 0);
Pen := New GxPen.CreateSolid(Color, 2);
ArrowStyle.Border := Pen;
// Apply label style
LabelStyle := New VZLabelStyle.Create;
Brush := New GxSolidBrush.Create(New GxColor.CreateRGB(120, 0, 120));
LabelStyle.Background := Brush;
LabelStyle.BorderPen := Pen;
Font := New GxFont.Create("Arial", 12, GxFontStyle.Bold, GxUnit.Point);
LabelStyle.Font := Font;
LabelStyle.FontShadowColor := New GxColor.CreateRGB(180, 5, 180);
LabelStyle.MaskText := "Arrow";
LabelStyle.NoDataText := "NoData";
ArrowStyle.LabelStyle := LabelStyle;
// Apply tooltip style
TtStyle := New VZTooltipStyle.Create;
TtStyle.HoverMode := VisualizatorHoverMode.Click;
TtStyle.Background := Brush;
TtStyle.BorderPen := Pen;
TtStyle.Font := Font;
TtStyle.FontShadowColor := New GxColor.CreateRGB(180, 5, 180);
TtStyle.MaskText := "Arrow";
TtStyle.NoDataText := "NoData";
ArrowStyle.ToolTipStyle := TtStyle;
// Output metric type to console window
AV := ArrowStyle.ArrowVisual;
Debug.WriteLine("Metric type for data mapping to arrow color - " + AV.BackgroundMapping.AttributeId);
Debug.WriteLine("Metric type for mapping to arrow size - " + AV.BasementWidthMapping.AttributeId);
// Save changes
(EaxAnalyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example:
All arrows except for one are removed from the collection.
Identifier, entry and exit points are changed for arrow.
A label with style is created.
A tooltip is created on the main mouse button click on arrow.
The console window displays types of metrics for mapping to various settings.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Visualizators;
…
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
EaxAnalyzer: IEaxAnalyzer;
Map: IVZMapChart;
Arrows: IVZMapChartArrows;
Arrow: VZMapChartArrow;
ArrowStyle: IVZMapChartArrowStyle;
Color, Color_F, Color_Z: GxColor = New GxColorClass_2();
Pen: GxPen = New GxPenClass();
LabelStyle: VZLabelStyle;
Brush: GxSolidBrush = New GxSolidBrushClass();
Font: GxFont = New GxFontClass();
TtStyle: VZToolTipStyle;
AV: IVZMapChartArrowVisual;
Begin
// Get repository
Metabase := Params.Metabase;
// Get express report
EaxAnalyzer := Metabase.ItemById["EXPRESS"].Edit() As IEaxAnalyzer;
// Get express report map
Map := EaxAnalyzer.MapChart.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow := Arrows.Item[0];
Arrows.Clear();
Arrows.Add(Arrow);
// Change identifier, arrow entry and exit points
Arrow.ArrowId := "ArrowID";
Arrow.StartShapeId := Map.RootLayer.SubLayers.Item[0].Shapes.Item[10].ShapeId;
Arrow.EndShapeId := Map.RootLayer.SubLayers.Item[0].Shapes.Item[30].ShapeId;
// Get default arrow style and change it
ArrowStyle := Map.DefaultArrowStyle;
// Change arrow bend angle
ArrowStyle.Angle := 45;
// Change arrow type to shaped
ArrowStyle.ArrowType := MapChartArrowType.mcatFigured;
// Arrow head size does not depend on its length
If ArrowStyle.IsRelativeWidth Then
ArrowStyle.IsRelativeWidth := False;
End If;
// Arrow head size
ArrowStyle.PointerLength := 30;
ArrowStyle.PointerWidth := 30;
// Change arrow label position by entire length
ArrowStyle.TextOrientation := MapChartArrowTextOrientation.mcatoAlongTheArrow;
// Create arrow border
Color.CreateRGB(0, 0, 0);
Pen.CreateSolid(Color, 2);
ArrowStyle.Border := Pen;
// Apply label style
LabelStyle := New VZLabelStyle.Create();
Color_F.CreateRGB(120, 0, 120);
Brush.Create(Color_F);
LabelStyle.Background := Brush;
LabelStyle.BorderPen := Pen;
Font.Create("Arial", 12, GxFontStyle.gfsBold, GxUnit.guPoint);
LabelStyle.Font := Font;
Color_Z.CreateRGB(180, 5, 180);
LabelStyle.FontShadowColor := Color_Z;
LabelStyle.MaskText := "Arrow";
LabelStyle.NoDataText := "NoData";
ArrowStyle.LabelStyle := LabelStyle;
// Apply tooltip style
TtStyle := New VZTooltipStyle.Create();
TtStyle.HoverMode := VisualizatorHoverMode.vhmClick;
TtStyle.Background := Brush;
TtStyle.BorderPen := Pen;
TtStyle.Font := Font;
TtStyle.FontShadowColor := Color_Z;
TtStyle.MaskText := "Arrow";
TtStyle.NoDataText := "NoData";
ArrowStyle.ToolTipStyle := TtStyle;
// Output metric type to console window
AV := ArrowStyle.ArrowVisual;
System.Diagnostics.Debug.WriteLine
("Metric type for data mapping to arrow color - " + AV.BackgroundMapping.AttributeId);
System.Diagnostics.Debug.WriteLine
("Metric type for mapping to arrow size - " + AV.BasementWidthMapping.AttributeId);
// Save changes
(EaxAnalyzer As IMetabaseObject).Save();
End Sub;
See also: