DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with report and 2d axis system

Solved!
Go to solution

Hi there, i'm trying to write a script with diadem that writes some 2d axis system in the report  but i'm having a lot of problems with it .

What i'm trying to do is make 3 or more 2d axis system in the report, each one displaying a part of data of 2 channels (ch0 = x , ch1 = y).

With only 1 graph i get what i want, but when i try to add the 2nd or the 3rd,they show without my defined x-scale and with the x offset different from the first graph.

 I've tried everything but i wasn't able to fix it

I've added as Attachements the .csv file that i'm using for ch0 and ch1 and 2 screen shoots  "what i get" (related to the problem with the script) and "what i hope to get" (made it manually, that's what i'm trying to get in the report)

Any help will be appreciated, thanks in advance

 

Ierman

 

I'll post my code here:

 

Dim Xscale, Yscale
Xscale=Array(0,25,0,5,49)
Yscale=Array(-0.2,0.2,-0.2,10,4)
 
Call PicDelete()                          
Call GraphObjNew("2D-Axis","2DAxis1")
Call GRAPHObjOpen("2DAxis1")
 D2AxisTop        =1                     

 D2AxisBottom     =70
 D2AxisLeft       =1
 D2AxisRight      =1
Call GRAPHObjOpen("2DYAxis1_1")
             D2AxisyScaleType ="manual"     
            D2AXISYBEGIN = Yscale(0)
            D2AXISYEND = Yscale(1)
            D2AXISYORIGIN = Yscale(2)
            D2AXISYTICK = Yscale(3)
            D2AXISYMINITICK = Yscale(4)
Call GRAPHObjClose("2DYAxis1_1") 
Call GRAPHObjOpen("2DXAxis1_1")
            D2AxisxScaleType ="manual"
            D2AXISXBEGIN = Xscale(0)
            D2AXISXEND = Xscale(1)
            D2AXISXORIGIN = Xscale(2)
            D2AXISXTICK = Xscale(3)
            D2AXISXMINITICK = Xscale(4)
            D2AxisXTxt = " "

            D2AxisXColor = "black"

            D2AxisXTickAuto = 1
            D2MTickLineWidth(1) = 0.1
            D2MTickLineType(1) = "solid"
            D2AxisXTickSize = 60
            D2AxisXTxtAutoCo = 0
            D2MTickColor = "red"
Call GRAPHObjClose("2DXAxis1_1")
 Call  GraphObjNew("2D-Curve","New_Curve") 

  Call GraphObjOpen("New_Curve")         

    D2CCHNX          ="[1]/[1]"            

    D2CCHNY          ="[1]/[2]"            

    D2CurveColor = "red"
Call GraphObjClose("New_Curve") 
Call GRAPHObjClose("2DAxis1")
   


Dim Xscale1, Yscale1
Xscale1=Array(25,50,0,5,49)
Yscale1=Array(-0.2,0.2,-0.2,10,4)
Call GraphObjNew("2D-Axis","grafic")
Call GRAPHObjOpen("grafic")
 D2AxisTop        =40                    

  D2AxisBottom     =37
  D2AxisLeft       =1
  D2AxisRight      =1
Call GRAPHObjOpen("2DYAxis1_2")
            D2AxisyScaleType ="manual"     
            D2AXISYBEGIN = Yscale1(0)
            D2AXISYEND = Yscale1(1)
            D2AXISYORIGIN = Yscale1(2)
            D2AXISYTICK = Yscale1(3)
            D2AXISYMINITICK = Yscale1(4)
            D2AxisYTxt = " " ' testo label asse y
Call GRAPHObjClose("2DYAxis1_2") 
Call GRAPHObjOpen("2DXAxis1_2")
            D2AxisxScaleType ="manual"
            D2AXISXBEGIN = Xscale1(0)
            D2AXISXEND = Xscale1(1)
            D2AXISXORIGIN = Xscale1(2)
            D2AXISXTICK = Xscale1(3)
            D2AXISXMINITICK = Xscale1(4)
            D2AxisXTxt = ""

            D2AxisXColor = "black"

            D2AxisXTickAuto = 1
            D2MTickLineWidth(1) = 0.1
            D2MTickLineType(1) = "solid"
            D2AxisXTickSize = 60
            D2AxisXTxtAutoCo = 0
            D2MTickColor = "red"      
Call GRAPHObjClose("2DXAxis1_2")
Call  GraphObjNew("2D-Curve","New_Curve1")

Call GraphObjOpen("New_Curve1")           

    D2CCHNX          ="[1]/[1]"            

    D2CCHNY          ="[1]/[2]"             

    D2CurveColor = "red"
Call GraphObjClose("New_Curve1") 
Call GRAPHObjClose("grafic")

   
   

 

Download All
0 Kudos
Message 1 of 4
(4,130 Views)


Dim Xscale2, Yscale2
Xscale2=Array(50,75,0,5,49)
Yscale2=Array(-0.2,0.2,-0.2,10,4)
Call GraphObjNew("2D-Axis","grafic2")
Call GRAPHObjOpen("grafic2")
 D2AxisTop        =70                     

  D2AxisBottom     =1
  D2AxisLeft       =1
  D2AxisRight      =1
Call GRAPHObjOpen("2DYAxis1_3")
            D2AxisyScaleType ="manual"     
            D2AXISYBEGIN = Yscale2(0)
            D2AXISYEND = Yscale2(1)
            D2AXISYORIGIN = Yscale2(2)
            D2AXISYTICK = Yscale2(3)
            D2AXISYMINITICK = Yscale2(4)
            D2AxisYTxt = " "

Call GRAPHObjClose("2DYAxis1_3") 
Call GRAPHObjOpen("2DXAxis1_3")
            D2AxisxScaleType ="manual"
            D2AXISXBEGIN = Xscale2(0)
            D2AXISXEND = Xscale2(1)
            D2AXISXORIGIN = Xscale2(2)
            D2AXISXTICK = Xscale2(3)
            D2AXISXMINITICK = Xscale2(4)
            D2AxisXTxt = " "

            D2AxisXColor = "black"

            D2AxisXTickAuto = 1
            D2MTickLineWidth(1) = 0.1
            D2MTickLineType(1) = "solid"
            D2AxisXTickSize = 60
            D2AxisXTxtAutoCo = 0
            D2MTickColor = "red"      
Call GRAPHObjClose("2DXAxis1_3")
Call  GraphObjNew("2D-Curve","New_Curve2")

Call GraphObjOpen("New_Curve2")           

    D2CCHNX          ="[1]/[1]"          

    D2CCHNY          ="[1]/[2]"            

    D2CurveColor = "red"
Call GraphObjClose("New_Curve2") 
Call GRAPHObjClose("grafic2")
Call PicUpdate() 

 

 Had to split it in 2 

0 Kudos
Message 2 of 4
(4,129 Views)
Solution
Accepted by Ierman

Hi lerman,

 

Here's an edited version of your code that works on my computer.  One proble that I know I fixed was that your REPORT layout was in name-oriented mode but you were using the number-oriented variables to assign he X and Y channels.  Running these commands in a FOR loop makes it much easier to debug the code and avoid trouble to begin with.

 

Brad Turpin
DIAdem Product Support Engineer

National Instruments

Message 3 of 4
(4,109 Views)

It's working flawless, thanks a lot Brad Turpin!!

 

0 Kudos
Message 4 of 4
(4,101 Views)