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 line graph map and editing the methods and properties of the line graph map.
To run this script:
- Copy the script below, or click here to download the BAS file: Create_LineGraph_Map.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_LineGraph_Map.BAS ' Copyright (C) Golden Software Inc. 1992-2015 ' ' This sample demonstrates how to create a line graph map and change the properties ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Main 'Creates an instance of the MapViewer Application object 'and assigns it to the variable named "mvApp" Set mvApp = CreateObject("MapViewer.Application") 'Makes the application main window visible mvApp.Visible = True 'Assigns the location of the samples folder to the variable "InPath" InPath$ = mvApp.ApplicationFolder + "samples\" 'Creates a map document object, and assigns it to the variable named "Plot" Set Plot = mvApp.Documents.Add(DocType:=mvDocPlot) 'Creates a line graph map object and assigns it to the variable named "LineGraphMap" Set LineGraphMap = Plot.CreateLineGraphMap(InPath$ + "co2010.gsb", InPath$ + "co2010.dat", "", _ "SecondaryIDField=2, Attribute1Field=1", 1, 7) 'Sets the baseline for a line graph map LineGraphMap.AddBaseline = True 'Sets the state of the break line for a line graph map LineGraphMap.AddBreakLine = True 'Sets a graph's base height to 0.5 LineGraphMap.BaseHeight=0.05 'Sets the properties for the baseline LineGraphMap.Baseline.color = mvColorOrange LineGraphMap.Baseline.Width = 0.05 LineGraphMap.Baseline.Style = "Dash Dot" 'Sets the properties for the break line LineGraphMap.BreakLine.color = mvColorNeonRed LineGraphMap.BreakLine.Width = 0.02 LineGraphMap.BreakLine.Style = "Dash Dot Dot" 'Sets the data break value for a line graph map to 40000 LineGraphMap.BreakValue=40000 'Sets the state of descending order graphing LineGraphMap.DescendingOrder=True 'Sets the state of using global data from the worksheet LineGraphMap.GlobalData = True 'Sets the fill properties for the line graph LineGraphMap.GraphFill.ForeColor = mvColorBlue LineGraphMap.GraphFill.BackColor = mvColorGreen LineGraphMap.GraphFill.Pattern="Forward Slash" LineGraphMap.GraphFill.Transparent = True 'Sets the graph height to 0.75 LineGraphMap.GraphHeight=0.75 'Sets the graph line properties LineGraphMap.GraphLine.color=mvColorPurple LineGraphMap.GraphLine.Width = 0.01 'Sets the graph position centroid offset type to User Defined LineGraphMap.GraphPosOffsetType=mvPosOffsetUser 'Sets the graph position X offset. LineGraphMap.GraphPosXOffset=0.05 'Sets the Graph position Y offset. LineGraphMap.GraphPosYOffset=-0.5 'Sets the state of horizontal graph LineGraphMap.HorizontalGraph=True 'Sets the PID column of the worksheet. 'LineGraphMap.PIDCol=4 'Sets the Profile fill properties LineGraphMap.ProfileFill.ForeColor=mvColorForestGreen LineGraphMap.ProfileFill.BackColor=mvColorBabyBlue LineGraphMap.ProfileFill.Pattern="Gravel" 'Sets the Profile line properties LineGraphMap.ProfileLine.color = mvColorBlue LineGraphMap.ProfileLine.Width = 0.02 'Returns the state of the User Limits checkbox Debug.Print "UserLimits = "+LineGraphMap.UserLimits 'Returns the User Limits max value Debug.Print "UserLimitMaxVal = "+LineGraphMap.UserLimitMaxVal 'Returns the User Limits min value Debug.Print "UserLimitMinVal = "+LineGraphMap.UserLimitMinVal 'Creates a legend for the map Set Legend = LineGraphMap.CreateLegend(-2,6) 'Adds the LineGraphMap information in Layer #1 to legend LineGraphMap.AddLayerToLegend("Layer #1") End Sub
Updated August 20, 2018
Comments
0 comments
Please sign in to leave a comment.