MapChart: IVZMapChart;
MapChart: Prognoz.Platform.Interop.Vizualizators.VZMapChart;
The MapChart property returns an object containing map display parameters in express report.
Map is used to display map data, it is based on a two-dimension table and usually consists of one row or column from this table as territory filling. Territory filling is determined by start and end colors, which correspond to minimum and maximum values on the map.
Executing the example requires that the repository contains an express report with the EXPRESS_BO 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;
Arrow1, Arrow2: 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_BO").Edit As IEaxAnalyzer;
// Get express report map
Map := EaxAnalyzer.MapChart.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow1 := Arrows.Item(0);
// Get map arrow
Map := Arrow1.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow2 := Arrows.Item(1);
Arrows.Clear;
Arrows.Add(Arrow2);
// Change arrow identifier, entry and exit points
Arrow2.ArrowId := "ArrowID";
Arrow2.StartShapeId := Map.RootLayer.SubLayers.Item(0).Shapes.Item(30).ShapeId;
Arrow2.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 figured
ArrowStyle.ArrowType := MapChartArrowType.Figured;
// Arrow head sizes do not depend on its length
If ArrowStyle.IsRelativeWidth Then
ArrowStyle.IsRelativeWidth := False;
End If;
// Arrow head sizes
ArrowStyle.PointerLength := 20;
ArrowStyle.PointerWidth := 20;
// Change arrow label position lengthwise
ArrowStyle.TextOrientation := MapChartArrowTextOrientation.Horizontal;
// Create an arrow border
Color := New GxColor.CreateRGB(0, 0, 0);
Pen := New GxPen.CreateSolid(Color, 1);
ArrowStyle.Border := Pen;
// Apply label style
LabelStyle := New VZLabelStyle.Create;
Brush := New GxSolidBrush.Create(New GxColor.CreateRGB(128, 128, 128));
LabelStyle.Background := Brush;
LabelStyle.BorderPen := Pen;
Font := New GxFont.Create("Tahoma", 12, GxFontStyle.Bold, GxUnit.Point);
LabelStyle.Font := Font;
LabelStyle.FontShadowColor := New GxColor.CreateRGB(0, 5, 0);
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;
// Display metric type in the console window
AV := ArrowStyle.ArrowVisual;
Debug.WriteLine("Metric type for mapping data with arrow color - " + AV.BackgroundMapping.AttributeId);
Debug.WriteLine("Metric type for mapping with arrow size - " + AV.BasementWidthMapping.AttributeId);
// Save changes
(EaxAnalyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example all arrows are deleted from the collection, except for the one: identifier, entry and exit points are changed for the arrow; a label with style is created; a main mouse button click tooltip is created; the console window displays metric types for mapping various settings, the arrow map is obtained from the express report map arrow.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
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;
Arrow1, Arrow2: 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_BO"].Edit() As IEaxAnalyzer;
// Get express report map
Map := EaxAnalyzer.MapChart.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow1 := Arrows.Item[0];
// Get map arrow
Map := Arrow1.MapChart;
// Get map arrows
Arrows := Map.Arrows;
Arrow2 := Arrows.Item[1];
Arrows.Clear();
Arrows.Add(Arrow2);
// Change arrow identifier, entry and exit points
Arrow2.ArrowId := "ArrowID";
Arrow2.StartShapeId := Map.RootLayer.SubLayers.Item[0].Shapes.Item[30].ShapeId;
Arrow2.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 figured
ArrowStyle.ArrowType := MapChartArrowType.mcatFigured;
// Arrow head sizes do not depend on its length
If ArrowStyle.IsRelativeWidth Then
ArrowStyle.IsRelativeWidth := False;
End If;
// Arrow head sizes
ArrowStyle.PointerLength := 20;
ArrowStyle.PointerWidth := 20;
// Change arrow label position lengthwise
ArrowStyle.TextOrientation := MapChartArrowTextOrientation.mcatoHorizontal;
// Create an arrow border
Color.CreateRGB(0, 0, 0);
Pen.CreateSolid(Color, 2);
ArrowStyle.Border := Pen;
// Apply label style
LabelStyle := New VZLabelStyle.Create();
Color_F.CreateRGB(128, 128, 128);
Brush.Create(Color_F);
LabelStyle.Background := Brush;
LabelStyle.BorderPen := Pen;
Font.Create("Tahoma", 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;
// Display metric type in the console window
AV := ArrowStyle.ArrowVisual;
System.Diagnostics.Debug.WriteLine("Metric type for mapping data with arrow color - " + AV.BackgroundMapping.AttributeId);
System.Diagnostics.Debug.WriteLine("Metric type for mapping with arrow size - " + AV.BasementWidthMapping.AttributeId);
// Save changes
(EaxAnalyzer As IMetabaseObject).Save();
End Sub;
See also: