There is not a direct way from the user-interface to link plot names to worksheet cells, but you can get this result by running the script below.
- Copy the script below, or click here to download the BAS file: NamePlots.BAS.
- Open your Grapher project, making sure it just contains a single graph with plots from adjacent columns in one data file.
- Make sure you have the Script Manager showing. If not, click View | Display | Script Manager to turn it on.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click the open file icon (), select the BAS file from your downloads directory, and click Open.
- Update the 'datafile' and 'shift' variables on lines 18 and 19.
- Click the green arrow () to run the script.
'================================================= '1. Open a Grapher file with one graph containing many plots from a single data file. '2. Define the datafile that these plots were created from (line 18). '3. Define a shift such that 1+shift=first variable column number (line 19) ' (i.e. if first variable col is B , shift=1). '4. Script changes the plot names to the variable name from the header row. '================================================= Sub Main 'Initializes Grapher Dim Grapher As Object Set Grapher = CreateObject("Grapher.Application") Grapher.Visible = True '============================= 'User-defined variables '----------------------------- datafile="C:\program files\golden software\grapher 12\samples\3D bar chart.dat" shift = 1 'Number to add to 1 to get to the first variable column '============================= 'Defines the active plot window and opens the desired data file in the worksheet Set Plot1 = Grapher.Documents.Active Set Data = Grapher.Documents.Open(datafile) 'Defines the Graph object Set Graph1 = Plot1.Shapes.Item(1) 'Loops through all of the plots, setting the plot names to the header row from the data For i=1 To Graph1.Plots.Count Data.Activate Data.Cells(1,i+shift).Copy() Plot1.Activate Graph1.Plots.Item(i).Name = Clipboard$() Next i End Sub
Updated August 7, 2017