To create a wind chart and how to change all the methods and properties:
- Click here to download the BAS file: WindChart.BAS.
- Click Automation | Scripts | Run, select the BAS file from your downloads directory, and click Open.
OR:
- Copy the script below.
- Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
- Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
- Press Ctrl+V to paste it into the Script Manager.
- Click the Start/Resume icon (
) in the Script Manager.
Sub Main
'Declare Objects
Dim GrapherApp, Plot, Graph, WindChart As Object
'Creates an instance of Grapher named "GrapherApp"
Set GrapherApp = CreateObject("Grapher.Application")
'Make Grapher visible
GrapherApp.Visible = True
'Creates a new plot document and assigns it to the variable named "Plot"
Set Plot = GrapherApp.Documents.Add(grfPlotDoc)
'Creates a graph and assigns it to the variable named "Graph"
Set Graph = Plot.Shapes.AddWindChartGraph(GrapherApp.Path+ "\samples\wind data.dat")
'Set WindChart to the first plot on the Graph graph
Set WindChart = Graph.Plots.Item(1)
'Set the columns
WindChart.dataCol = 1
WindChart.speedCol = 2
'Set the angular size of automatic bins to 45 degrees
WindChart.binSize = 45
'Turn auto arc size off for automatic bins
WindChart.ArcSizeAuto = False
'Set the arc size of the automatic bins to 10 degrees
WindChart.ArcSize = 10
'Set the starting place for the bins
WindChart.StartAt = 22.5
'Add a legend to the graph
WindChart.DisplayLegend = True
'Display the speed bins as percents then as relative frequency
WindChart.DisplayAsPercent = True
WindChart.DisplayAsFreq = True
'Delete existing speed bins
WindChart.DeleteAllBins
'Set the bins to custom bins
WindChart.AutoBin = False
'Set the new angle limits for each bin
WindChart.AddBin(0,45)
WindChart.AddBin(45,90)
WindChart.AddBin(90,270)
WindChart.AddBin(270,270,,True)
'Delete the last angle limits bin
WindChart.DeleteBin(4)
'Turn on automatic binning
WindChart.AutoBin = True
'Delete all existing wind speed bins
WindChart.DeleteAllSpeedBins
'Create new speed bins
WindChart.AddSpeedBin(0,2,True) ' This one has no minimum
WindChart.SpeedBinFill(1).ForeColor = RGB(120,75,135)
WindChart.AddSpeedBin(2,4)
WindChart.SpeedBinFill(2).ForeColor = RGB(88,85,162)
WindChart.AddSpeedBin(4,6)
WindChart.SpeedBinFill(3).ForeColor = RGB(69,123,186)
WindChart.AddSpeedBin(6,8)
WindChart.SpeedBinFill(4).ForeColor = RGB(41,163,205)
WindChart.AddSpeedBin(8,10)
WindChart.SpeedBinFill(5).ForeColor = RGB(63,151,155)
WindChart.AddSpeedBin(10,12)
WindChart.SpeedBinFill(6).ForeColor = RGB(98,164,100)
WindChart.AddSpeedBin(12,14)
WindChart.SpeedBinFill(7).ForeColor = RGB(181,204,97)
WindChart.AddSpeedBin(14,16)
WindChart.SpeedBinFill(8).ForeColor = RGB(239,198,89)
WindChart.AddSpeedBin(16,18)
WindChart.SpeedBinFill(9).ForeColor = RGB(233,155,95)
WindChart.AddSpeedBin(18,18,,True) ' This one has no maximum
WindChart.SpeedBinFill(10).ForeColor = RGB(209,106,94)
'Change the line style and color
WindChart.Line.Style = "Solid"
WindChart.Line.ForeColor = grfColorWhite
End Sub
Updated August 2019
Comments
Please sign in to leave a comment.