KB no longer maintained - MapViewer is a Legacy Product. Legacy Products are still supported, but no longer receive new features or updates. Many of MapViewer's features have been moved to Surfer. Please contact support@goldensoftware.com with any questions. |
This article contains a sample script for creating a bar map and editing the methods and properties of the bar map.
To run this script:
- Copy the script below, or click here to download the BAS file: Create BarMap.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
*********
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Create_Bar_Map.BAS ' Copyright (C) Golden Software Inc. 1992-2015 ' ' This sample demonstrates how to create a bar map and change many of the properties. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Main 'Declare the variable that will reference the application Dim mvapp As Object 'Creates an instance of the MapViewer Application object ' and assigns it to the variable named "mvapp" Set mvapp = CreateObject("MapViewer.Application") 'Make MapViewer visible mvapp.Visible = True 'Declare Plot and BarMap as Object Dim Plot, BarMap As Object 'Creates a new plot window Set Plot = mvapp.Documents.Add(mvDocPlot) 'Sets the file path InPath$ = mvapp.ApplicationFolder + "samples\" 'Create a bar map Dim pVarCols(2) As Long pVarCols(0) = 8 : pVarCols(1) = 9 Set BarMap = Plot.CreateBarMap(pVarCols(), BoundaryFileName:=InPath$+"in2010.gsb", _ DataFileName:=InPath$+"in2010.dat", PIDCol:=1) 'Returns whether negative bars are allowed Debug.Print "Negative bars are mapped ";BarMap.AllowNegativeBar 'Allows the display of negative bars BarMap.AllowNegativeBar = True 'Returns whether bars are in 3D Debug.Print "Bars are in 3D ";BarMap.Bar3DFace 'Allows the display of 3D bars BarMap.Bar3DFace = True 'returns whether the bar color is used for text Debug.Print "Text uses bar color ";BarMap.BarColorForText 'Sets the text color to the bar color BarMap.BarColorForText = True 'Returns whether the bar color is used for the text lead line Debug.Print "Lead line uses bar color ";BarMap.BarColorForTextLead 'Sets the text lead line to the bar color BarMap.BarColorForTextLead = True 'Returns the bar position offset type relative to the centroid Debug.Print "The bar is positioned ";BarMap.BarPosOffsetType 'Sets the bar position offset type BarMap.BarPosOffsetType = mvPosOffsetUser 'Returns the X Offset value Debug.Print "The X offset value is ";BarMap.BarPosXOffset 'Sets the X offset value for user defined bar position BarMap.BarPosXOffset = 0.2 'Returns the Y Offset value Debug.Print "The Y offset value is ";BarMap.BarPosYOffset 'Sets the Y offset value for user defined bar position BarMap.BarPosYOffset = .075 'Returns whether bar maps use a baseline Debug.Print "Bar map displays a baseline ";BarMap.Baseline 'Turns on the baseline display BarMap.Baseline = True 'Sets the baseline color BarMap.BaselineColor.color = mvColorBlack50 'Returns the baseline value Debug.Print "The baseline of variable 1 is at ";BarMap.BaseVal(1) 'Sets the baseline value BarMap.BaseVal(1) = 5 'Returns whether text is located to the left of the bar Debug.Print "Text is to left of bar ";BarMap.DataTextToLeft 'Sets the text to the left BarMap.DataTextToLeft = True 'Returns whether the text is drawn for the bars Debug.Print "Text is shown for bar maps ";BarMap.DrawDataText 'Sets the display of the text BarMap.DrawDataText = True 'Sets the fill for bars BarMap.Fill(1).ForeColor = mvColorPurple 'Sets the font size BarMap.Font.Face = "Arial" 'Returns whether globabl data are used Debug.Print "Global data are used ";BarMap.GlobalData 'Sets the display of global data BarMap.GlobalData = True 'Returns whether bars are horizontal Debug.Print "Bars are horizontal ";BarMap.HorizontalBar 'Sets the display of bars to horizontal BarMap.HorizontalBar = True 'Returns the shortest lead line segment length to the bar Debug.Print "The shortest lead line length to the bar is ";BarMap.LeadSegToBars 'Sets the shortest lead line length to the bar BarMap.LeadSegToBars = 0.25 'Return shortest lead line segment to the text Debug.Print "The shortest lead line length to text is ";BarMap.LeadSegToText 'Set the shortest lead line length to the text BarMap.LeadSegToText = 0.25 'Set the line properties BarMap.Line.Color = mvColorRed 'Returns whether increment marks are visible Debug.Print "Increment marks are visible ";BarMap.Mark 'Turns on the display of increment marks BarMap.Mark = True 'Returns the increment mark value for the first variable Debug.Print "The increment value for marks is ";BarMap.MarkInc(1) 'Sets the increment mark data value for the first variable BarMap.MarkInc(1) = 50000 'Returns the maximum height for the first variable bars Debug.Print "The maximum bar height for the first variable is ";BarMap.MaxHeight(1) 'Sets the maximum height for the first variable bars BarMap.MaxHeight(1)=0.9 'Returns the minimum height for the second variable bars Debug.Print "The minimum height for the second variable is ";BarMap.MinHeight(2) 'Sets the minimum height for the second variable bars BarMap.MinHeight(2)=0.1 'Returns the PID column Debug.Print "The PID is in column ";BarMap.PIDCol 'Set the PID column BarMap.PIDCol = 1 'Returns whether bar height is proportional across all variables Debug.Print "Bars are proportional across all variables ";BarMap.Proportional 'Sets bars to proportional height BarMap.Proportional = True 'Returns whether bars have a shaded face Debug.Print "Bars have a shaded bar face ";BarMap.Shading 'Sets bars to have a shaded bar face BarMap.Shading = True 'Return whether side fill is uniform for 3D bars Debug.Print "Sides are uniform color on 3D bars ";BarMap.Uni3DSideFaceFill 'Sets the side fill to uniform for 3D bars BarMap.Uni3DSideFaceFill = True 'Change the fill properties for the side fill on a uniform side 3D bar BarMap.SideFill.ForeColor = mvColorPastelBlue 'Returns whether bars are stacked Debug.Print "Bars are stacked ";BarMap.Stack 'Sets the display of bars to stacked BarMap.Stack = True 'Returns the scale of the arrow for the line leading to the text Debug.Print "The scale for the arrow for the text lead line is ";BarMap.TextLeadArrowScale 'Sets the scale for arrow on the line leading to the text BarMap.TextLeadArrowScale = 0.5 'Returns the style for the arrow on the end of the line leading to the text Debug.Print "The arrow used for the end of the text lead line is ";BarMap.TextLeadEndArrow Debug.Print " 1 = No arrow, 2 = Simple, 3 = Filled, 4 = Triangle, 5 = 2 Stick" 'Sets the arrow style for the end of the line leading to the text BarMap.TextLeadEndArrow = mvASSimple 'Sets the line properties for the text lead line BarMap.TextLeadLine.Width = 0.005 'Returns the style for the arrow on the start of the line leading to the text Debug.Print "The arrow used for the start of the text lead line is ";BarMap.TextLeadStartArrow Debug.Print " 1 = No arrow, 2 = Simple, 3 = Filled, 4 = Triangle, 5 = 2 Stick" 'Sets the arrow style for the line leading to the text BarMap.TextLeadStartArrow = mvASSimple 'Returns the 3D thickness of the bars for second variable Debug.Print "The 3D thickness of the bars for the second variable is ";BarMap.Thickness(2) 'Sets the 3D thickness of the bars for the second variable BarMap.Thickness(2)=0.25 'Returns the variable column for the first variable Debug.Print "The first variable is in column ";BarMap.VarCol(1) 'Sets the variable column for the first variable BarMap.VarCol(1)=10 'Returns the width for the bars for the first variable Debug.Print "The width of the first variable bar is ";BarMap.Width(1) 'Sets the width for the first variable bar BarMap.Width(1)=0.2 End Sub
Updated October 31, 2016
Comments
0 comments
Please sign in to leave a comment.