Load Grapher template using different files for different curves via automation

Below is an example script for loading a graph with a template and then changing the worksheet for a plot using Grapher's Scripter program.

 

When loading a template from a script, only one worksheet can be named in the Open command. After the template is opened, each curve can be selected and the worksheet used can be changed. This example shows how to load the template with one worksheet and change the worksheet for one curve. The first curve ("Line/Symbol Plot 1") will still use the worksheet named in the Open command line.

 

'Opens Template 
Set Plot = GrapherApp.Documents.Open ("c:\path\filename.grt", "c:\path\filename.dat") 
'Change worksheet of curve 2 
Dim Graph1, Line2 As Object
Set Graph1 = Plot.Shapes.Item(1)
Set Line2 = Graph1.Plots.Item(1)
Line2.worksheet = ("c:\path\filename2.dat") 

 

Updated August 2019

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

Comments

0 comments

Please sign in to leave a comment.