Sub Main 'This script shows all the methods 'and properties of a wind chart 'CSW 7/18/2 'Declares GrapherApp as an object Dim GrapherApp As Object 'Creates an instance of the Grapher Application 'object and assigns it to the variable named "GrapherApp" Set GrapherApp = CreateObject("Grapher.Application") 'Makes Grapher visible GrapherApp.Visible = True 'Declares Plot as an object Dim Plot As Object 'Creates a plot document in Grapher and 'assigns it to the variable named "Plot" Set Plot = GrapherApp.Documents.Add(grfPlotDoc) 'Declares Graph1 as an object Dim Graph1 As Object 'Creates a graph and assigns it to the variable named "Graph1" Set Graph1 = Plot.Shapes.AddWindChartGraph(GrapherApp.Path+ _ "\samples\winddata.dat") 'Declares WindChart as an object Dim WindChart As Object 'Set WindChart to the first plot on the Graph1 graph Set WindChart = Graph1.Plots.Item(1) 'Set the column used for speed (can 'also be set in AddWindChartGraph) WindChart.speedCol = 3 'return the column used for speed Debug.Print "Speed column = "; WindChart.speedCol 'Set the column used for direction (can 'also be set in AddWindChartGraph) WindChart.dataCol = 4 'return the column used for direction Debug.Print "Direction column = "; WindChart.dataCol 'Add a legend to the graph WindChart.DisplayLegend = True '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 'Delete existing speed bins WindChart.DeleteSpeedBin(1) WindChart.DeleteSpeedBin(1) WindChart.DeleteSpeedBin(1) WindChart.DeleteSpeedBin(1) 'Create new speed bins WindChart.AddSpeedBin(0,2,True) WindChart.AddSpeedBin(2,4) WindChart.AddSpeedBin(4,6) WindChart.AddSpeedBin(6,8) WindChart.AddSpeedBin(8,10) WindChart.AddSpeedBin(10,12) WindChart.AddSpeedBin(12,14) WindChart.AddSpeedBin(14,16) WindChart.AddSpeedBin(16,18) WindChart.AddSpeedBin(18,18,,True) Wait 2 'Turn off the automatic binning for direction WindChart.AutoBin = False 'Add new custom bins WindChart.AddBin(0,1) WindChart.AddBin(15,20) WindChart.AddBin(40,60) WindChart.AddBin(60,80) WindChart.AddBin(80,100) WindChart.AddBin(100,120) WindChart.AddBin(120,140) WindChart.AddBin(140,160) WindChart.AddBin(160,180) WindChart.AddBin(180,200) WindChart.AddBin(200,220) WindChart.AddBin(220,240) WindChart.AddBin(240,260) WindChart.AddBin(260,280) WindChart.AddBin(280,300) WindChart.AddBin(300,320) WindChart.AddBin(320,340) WindChart.AddBin(340,360) 'Delete the first two bins and make new ones WindChart.DeleteBin(1) WindChart.DeleteBin(1) WindChart.AddBin(0,20) WindChart.AddBin(20,40) 'Display labels as frequency Debug.Print "Labels as frequency = "; WindChart.DisplayAsFreq 'True to display as frequency WindChart.DisplayAsFreq=True 'Display labels as percent - need 'to display as frequency first Debug.Print "Labels as percent = "; WindChart.DisplayAsPercent WindChart.DisplayAsPercent=True 'Change the second speed bin's color WindChart.SpeedBinFill(2).PatternName = "Solid" WindChart.SpeedBinFill(2).foreColor = grfColorLightBlueGreen End Sub