Hi Melanie,
You can add a text graph object as title. Then set LongName of the workbook as text, and change position to the right place. Please refer to the following example.
void add_title()
{
GraphLayer gl = Project.ActiveLayer(); // get the active graph layer
if(!gl)
return;
DataPlot dp = gl.DataPlots(0); // get the first dataplot in the layer
if(!dp)
return;
string strDatasetName = dp.GetDatasetName(); // get data range of the plot
string strBookShortName = strDatasetName.GetToken(0, '_'); // get short name of the workbook
WorksheetPage wp(strBookShortName);
if(!wp)
return;
string strBookLongName = wp.GetLongName(); // get long name of the workbook
GraphObject go = gl.CreateGraphObject(GROT_TEXT, "MyTitle"); // create a text object
if( go )
{
go.Text = strBookLongName; // set long name to the text object
go.Attach = 2; // attach text object to layer, 0 to Layer; 1 to Page; 2 to Axes
go.X = gl.X.From+(gl.X.To-gl.X.From)/2.0; // middle of the X axis;
go.Y = gl.Y.To+go.DY; // top of the layer
}
gl.GetPage().Refresh(); // refresh the graph
}
Penn