DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in "GraphDeleteAll"

Hi,
 
I met a problem in the command "GraphDeleteAll" when writing a script. I want to set up a new graph after clear all the previous graphs but it failed. Below is my script:
 
Call GraphDeleteAll()
Call GraphSheetNGet(1)
Call GraphSheetRename(GraphSheetName,"Report Sheet 1")
  Call GraphObjNew("2D-Axis","2DAxis1")     
  Call GraphObjOpen("2DAxis1")
    Call GraphObjNew("2D-Curve", "2DObj1_Curve1")
    Call GraphObjOpen("2DObj1_Curve1")
      D2CChnXName = "Mst_1"     
      D2CChnYName = "Mst_100"
    Call GraphObjClose("2DObj1_Curve1")
  Call GraphObjClose("2DAxis1")
Call PicUpdate()
 
The result shows only an x-y coordinate without containing any values in the data channel Mst_1 and Mst_100. Is there any solutions?
Thanks
 
Zhiyao
0 Kudos
Message 1 of 3
(3,596 Views)

Hi Zhiyao,

When you create a new layout from scratch programmatically with the GraphDeleteAll() command, the resulting layout is by default number-oriented, meaning that it expects you to specify the channel references by channel number, which uses the following alternative variables:

    D2CChnX          ="[1]/Time"
    D2CChnY          ="[1]/Speed"

I would recommend that you programmatically switch the layout to use channel name referencing with the PicDefByIdent variable:

Call GraphDeleteAll()
Call GraphSheetNGet(1)
Call GraphSheetRename(GraphSheetName,"Report Sheet 1")
  PicDefByIdent    =1
  Call GraphObjNew("2D-Axis","2DAxis1")     
  Call GraphObjOpen("2DAxis1")
    Call GraphObjNew("2D-Curve", "2DObj1_Curve1")
    Call GraphObjOpen("2DObj1_Curve1")
      D2CChnXName = "[1]/Time"    
      D2CChnYName = "[1]/Speed"
    Call GraphObjClose("2DObj1_Curve1")
  Call GraphObjClose("2DAxis1")
Call PicUpdate()

Ask if you have further questions,
Brad Turpin
DIAdem Product Support Engineer
National Instuments

0 Kudos
Message 2 of 3
(3,583 Views)
Problem solved, thanks a lot Smiley Very Happy
0 Kudos
Message 3 of 3
(3,580 Views)