Inserting a standing alone fully made graph in a panel

Hello,

I have a question.

Suppose I have made and furnished (i.e. labeled, texted, ticked, ..etc)  a graph according to my need which is displayed as a stand alone graph (i.e. not embedded in any panel). Now I want to insert that fully furnished and polished graph in a panel which I made earlier. Is there a way to do that? I might be missing something. I went through the manual but it says you make an empty display window in the panel and then add traces to make the graph there. In that case, I need to build the graph again from the scratch which I don't want.

Thanks.

Save the graph as recreation macro, create a panel with a dummy graph and save as well. Then copy & paste the code of the graph to the appropriate position in the panel macro.

This may give you an idea of how to do this programatically. It relies on the fact that Execute can execute a window recreation macro:

Function Demo()
    KillWindow/Z DemoGraph
    KillWindow/Z DemoPanel
   
    // Make graph
    Make/O jack = sin(x/8)
    Display/N=DemoGraph jack
   
    // Get recreation macro for graph
    String tmp = WinRecreation("DemoGraph", 0)
   
    // Add /HOST flag to recreation macro
    tmp = ReplaceString("Display", tmp , "Display /HOST=#")
   
    // Create panel
    NewPanel/N=DemoPanel
   
    // Add graph to panel
    Execute tmp
End