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 pie map and editing the methods and properties of the pie map.
To run this script:
- Copy the script below, or click here to download the BAS file: Create Pie 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_Pie_Map.BAS ' Copyright (C) Golden Software Inc. 1992-2015 ' ' This sample demonstrates how to create a pie 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) Dim Variables(1 To 3) As Long Variables(1) = 7 Variables(2) = 8 Variables(3) = 9 'Creates a pie map object and assigns it to the variable named "PieMap" Set PieMap = Plot.CreatePieMap(Variables, InPath$+"co2010.gsb", InPath$+"co2010.dat", _ "SecondaryIDField=2, Attribute1Field=1", 1) '''''''''''''''''''' 'Sets the state of drawing multi-variable percentage text checkbox PieMap.DrawPercentage = True 'Sets the state of drawing percentage outside pie PieMap.DrawPercentageOutsidePie = True 'Sets the condition of drawing text lead PieMap.DrawTextLead = True 'Specifies the fill properties of variable number 2 PieMap.Fill(2).ForeColor=mvColorPurple PieMap.Fill(2).BackColor=mvColorGreen PieMap.Fill(2).Pattern="Diagonal Cross" PieMap.Fill(2).Transparent=False 'Specifies the font properties of the text labels PieMap.Font.Bold=True PieMap.Font.ForeColor=mvColorBlue PieMap.Font.Size=6 'Sets the state of using Global data from the worksheet PieMap.GlobalData=True 'Sets the condition of drawing percentage text horizontally PieMap.HorzText=True 'Specifies the line properties for the text lead lines PieMap.Line.Color=mvColorBlue PieMap.Line.Width=0.015 'Sets the maximum diameter of the pies PieMap.MaxDiam=0.75 'Sets the minimum diameter of the pies PieMap.MinDiam=0.35 'Sets the PID column of the worksheet PieMap.PIDCol=1 'Sets the 3D pie state PieMap.Pie3D=True 'Sets the 3D pie wall height to 0.1 PieMap.Pie3DWallHeight=0.1 'Sets the condition of using pie color for text PieMap.PieColorForText=True 'Sets the condition of using the pie map color(s) for the text lead lines PieMap.PieColorForTextLead=True 'Sets the pie centroid position offset type to User Defined PieMap.PiePosOffsetType=mvPosOffsetUser 'Sets the pie position X offset In units of 0.1 inch PieMap.PiePosXOffset=0.1 'Sets the pie position Y offset In units of 0.05 inch PieMap.PiePosYOffset=-0.05 'Sets the uniformed 3D pie wall fill state PieMap.PieUni3DWallFill=True 'Sets the scale of the arrow of the text lead line PieMap.TextLeadArrowScale=0.5 'Sets the End arrow of the Text lead Line PieMap.TextLeadEndArrow=mvASTriangle 'Sets the start arrow of the Text lead Line. PieMap.TextLeadStartArrow=mvASSimple 'Sets the text lead line properties PieMap.TextLeadLine.color=mvColorMartianGreen PieMap.TextLeadLine.Width=0.02 'Sets the text offset from pie edge PieMap.TextOffsetFromPie=0.25 'Sets the state of negative value handling PieMap.UseAbsoluteValue=True 'Sets the variable column of variable 3 to column 18. PieMap.VarCol(3)=18 'Returns the variable column of the worksheet Debug.Print "VarCol for Variable 3 = "+PieMap.VarCol(3) 'Sets the fill properties for 3D pie wall PieMap.WallFill.ForeColor=mvColorOrange PieMap.WallFill.Pattern="Sand" 'Creates a legend for the map Set Legend = PieMap.CreateLegend(-2,6) 'Adds PieMap information in Layer #1 to legend PieMap.AddLayerToLegend("Layer #1") 'Changes the proportion from Linear to Square Root PieMap.LinearProportion=False End Sub
Updated July 2, 2018
Comments
0 comments
Please sign in to leave a comment.