4.1.3 Accessing Embedded Graphs

List Embedded Graphs

List Embedded Graphs in the Project

List all embedded/floating graph pages in the project, along with embedding information(Worksheet, Row, Column).

doc -e P
{
   string wkb$, name$;	
    if(page.IsEmbedded==1) // list all embedded graphs
    {
        wkb$ = page.isEmbedded$;
        name$ = %(page.label$);
        if(name.Getlength()==0 ) name$ = %H;
	type "The embedded graph is %(name$)";
	type "It is in %(wkb$)";

    }
    if(page.IsEmbedded==2) // list all floating graphs
    {
        wkb$ = page.isEmbedded$;
        name$ = %(page.label$);
        if(name.Getlength()==0 ) name$ = %H;
	type "The floating graph is %(name$)";
	type "It is in %(wkb$)";
    }
}

List Embedded Graphs in Active Worksheet Cells

The example below lists all graphs embedded in cells in the active worksheet.

Notes: list -eg can also dump all the name of embedded graphs in the active worksheet to the Script Window (both those embedded in cells and those "floating" on the worksheet page). Please note that the information got from list -eg can not be further processed.
range rA = !; //define range of the active worksheet
doc -e P //loop over all graph window in project
{
    if(page.IsEmbedded==1) //if the graph is embedded in a worksheet cell
    {
        range rB = page.isEmbedded$; //define a range where the embedded graph locates
        if (rB.GetLayer() == rA.GetLayer())  
	{
		type %H;
	}

    };
}

Customize the Embedded Graphs

The example below re-scale each layer of a embedded graph to show all plots

//Suppose Graph2 is an embedded graph in workbook.
win -o Graph2
{
	doc -e LW //loop over all layers in the graph window
	{	
		Rescale;
	}
}