To create a graph with line plots and bar charts and export to a JPG file via automation:
- 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 green arrow Start/Resume icon in the Script Manager.
'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")
March 13, 2020