Create a multi-plot graph and export it to a JPG file in Grapher Automation

To create a graph with line plots and bar charts and export to a JPG file via automation: 

  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 green arrow Start/Resume icon in the Script Manager.

 


Sub Main
'Declares GrapherApp as an object Dim GrapherApp, Plot, Graph, LinePlot As Object Set GrapherApp = CreateObject("Grapher.Application") GrapherApp.Visible = True Set Plot = GrapherApp.Documents.Add(grfPlotDoc) 'Creates a line plot Set Graph = Plot.Shapes.AddLinePlotGraph(GrapherApp.Path+"\samples\tutorial.dat") Set LinePlot = Graph.Plots.Item(1) 'Add line plot that uses columns A and C for X and Y Graph.AddLinePlot(GrapherApp.Path+"\samples\tutorial.dat",1,3) 'Export to JPG Plot.Export("c:\temp\tutorial.jpg")
End Sub

 

March 13, 2020

 

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

Comments

0 comments

Please sign in to leave a comment.