Create a polar bar chart in Grapher via automation

To create a polar bar chart and how to change all the methods and properties via automation: 

  1. Click here to download the BAS file: AutoPolarBarChart.BAS.
  2. Click Automation | Scripts | Run, select the BAS file from your downloads directory, and click Open.


  1. Copy the script below.
  2. Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
  3. Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
  4. Press Ctrl+V to paste it into the Script Manager.
  5. Click the Start/Resume icon () in the Script Manager.



Sub Main
'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

'Creates a plot document in Grapher and assigns it to the variable named "Plot"
 Set Plot1 = GrapherApp.Documents.Add(grfPlotDoc)

'Creates a graph and assigns it to the variable named "PolarBarChartGraph"
 Set PolarBarChartGraph = Plot1.Shapes.AddPolarBarChartGraph(GrapherApp.Path+"\samples\wind data.dat")

'Set PolarBarChart to the first bar plot on the PolarBarChartGraph graph
 Set PolarBarChart = PolarBarChartGraph.Plots.Item(1)

'AutoPolarBarChart properties

'Returns the angle column
 Debug.Print "Angle column = "; PolarBarChart.aCol

'Sets the angle column to column D
 PolarBarChart.aCol = 1

'Returns the radius column
 Debug.Print "Radius column = "; PolarBarChart.rCol

'Sets the radius column to column C
 PolarBarChart.rCol = 2

'Return the if the angle width is automatically calculated
 Debug.Print "Angle width auto or custom = "; PolarBarChart.AutoAngleWidth

'Sets the angle width to custom
 PolarBarChart.AutoAngleWidth = False

'Returns the angle width
 Debug.Print "Angle width = "; PolarBarChart.AngleWidth

'Sets the angle width to two degrees
 PolarBarChart.AngleWidth = 2

'Returns the bar width
 Debug.Print "Bar width = "; PolarBarChart.barWidth

'Set the bar width to 85 percent
 PolarBarChart.barWidth = 85

'Returns the fill color
 Debug.Print "Fill color = "; PolarBarChart.Fill.foreColor

'Sets the fill color to blue
 PolarBarChart.Fill.foreColor = grfColorBlue

'Returns the label font face
 Debug.Print "Label font = "; PolarBarChart.Labels.Font.face

'Do not display labels
 PolarBarChart.Labels.ShowLabels = False

'Return the bar line style
 Debug.Print "Line style = ";

'Set the line color to green
 PolarBarChart.line.foreColor = grfColorGreen

'Determines if a multivariate polar bar chart is stacked
 Debug.Print "Stacked (stacked/adjacent) = "; PolarBarChart.Stacked

'Sets the stacking to adjacent
 PolarBarChart.Stacked = False

End Sub


Updated August 2019

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.