Supposed there is only one curve in each graph page, you can try this script:
// Loop over all graph windows
// Please read LabTalk help for detail info about doc command
doc -e P {
// Supposed there is only one plot in a graph
// Get the active plot dataset name
string scn = %c;
string sbn = scn.GetToken(1, "_")$;
string sbLN;
string sbSN;
// Get the book short name and long name
win -o %(sbn$) {
sbLN$ = page.longname$;
sbSN$ = page.name$;
}
// Change the current graph window longname
page.longname$ = sbLN$;
// Place the longname on the graph
// Please look into "Label" command to see how to fine ture
// label positions.
label -p 50 50 -s %(sbLN$)
}