DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot line in the middle of a time series

Hi

 

I am trying to plot the limits for a graph. These limits are specified for 10, 20 and 30 ms (In particular I want to plot the limits for neck calibration tests for H3 dummy calibration). For this I need to draw a line from 10 ms to 30 ms. How do I do this? So far I am generating a channel by using either chnlingen or chngenval or chd. But when I generate values from the middle obviously it makes the values from start of the time series to the point equal to 0.

 

Another problem im facing is in plotting a vertical line. How can I do this?  

0 Kudos
Message 1 of 9
(5,043 Views)

hi mechranjan,

to plot a horizontal "line":

  Call GraphObjOpen("2DAxis1")
                              Call GraphObjNew("2D-curve","cursor1")
                              D2CurveType(i)="Constant"
                              Call GraphObjOpen("cursor1")
                                      D2CConstXName   = value

                                      D2CConstYName   = "NOVALUE"
                                      D2CurveLineWidth=0.7
                              Call GraphObjClose("cursor1")
 Call GraphObjClose("2DAxis1") 

0 Kudos
Message 2 of 9
(5,040 Views)

Hi mechranjan,

 

Could you perhaps post a picture of what you want?  The post above with the code to create a horizontal line can be tweaked to create a vertical line, and you can also create either interactively in the 2D graph dialog.  Or do you want to graph a corridor of allowed values (in which case you do need explicit X and Y channels for the corridor points)?

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 9
(5,019 Views)

Hi thanks for the reply.

 

I have attached the report I have made. I have written a VBA code to fill in all the details and graphs accordingly. Now the test requirements are as given in the table. I need to specify that in the graph. I dont want the encircled straight line. Just the 2 limits from 10 to 30 ms. In fact the more correct and logical wasy of representing the limits would be 3 horizontal lines, 1 at 10 ms from 22.5-27.5g, 1 at 20 ms from 17.6-22.6g and 1 at 30 ms from 12.5-18.5g.

 

Hope i have put my doubt across clearly. Again with the code you have given, I dont know how to 'tell' diadem to plot that particular graph in that particular X-Y plot in the report/LPD.

 

For the 2 lines, this is the code i have written.

 

'Find 10 ms time

        L3= ChnLength(1)
        L4 = 0
        Do while (L4 < L3)
        L4= L4 + 1
        R1= ChD(L4,1)
          If (R1 > 0.01) Then
                Exit Do
          end if
                 Loop   
        L4= L4 - 1
        LT10=L4

 

'Find 20 ms time
       
        Do while (L4 < L3)
        L4= L4 + 1
        R1= ChD(L4,1)
          If (R1 > 0.02) Then
                Exit Do
          end if
                 Loop   
        L4= L4 - 1
       

 LT20=L4

 LT1 = LT20-LT10
          For i  = 0 to LT1 'Lt1 is var for channel length from 10 ms to 20 ms
            ChD(LT10+i,"Upper limit") = 27.5-(4.9*i/LT1)
          Next

 

 Thanks again. Waiting for your kind help!

 

0 Kudos
Message 4 of 9
(5,001 Views)

Hi mechranjan,

 

Thank you for the picture and the code, I now understand most of your problem (all except the bit about the "vertical line").  Make these minor modifications at the end of your script to get rid of the initial points by assigning the Null value and getting rid of any subsequent points by setting the ChnLength of the Upper limit channel to end at the last point you assigned.

          For i = 1 TO LT10-1
            ChD(i,"Upper limit") = Null
          Next
          For i = 0 to LT1
            ChD(LT10+i,"Upper limit") = 27.5-(4.9*i/LT1)
          Next
          ChnLength("Upper limit") = LT10+i-1

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 5 of 9
(4,977 Views)

Thanks Brad. I'll try it out at work today.

 

Ok about the vertical line- the requirement of the graph is that at 10ms Y has to be between 2 values, then 20 ms Y has to be between another 2 values. So all i need is 2 vertical lines showing these limits at 10 ms and 20 ms. The graph has to cut these 2 lines at 10 and 20 ms indicating that the requirement is met. In between 10ms and 20 ms the graphs can go to any value no issue. Now if i plot the straight lines as I have done, it indicates that the graph has to fall in the limits for 10 to 20ms also which is not the case. For many of my tests, the graphs meet the requirement at 10, 20 and 30 ms as required but inbetween it goes beyond the limit lines I have drawn (which is allowed) but this looks like it is failing.

 

I have attached an illustration of the problem. Hope it understands. I did it in paint. In the first pic u can see that al though it meets the requirements, it looks like it doesnt. But if i can plot 2 vertical lines like in the second pic, it is a better way of representation.

 

Hope it is clear now. Thanks again.

0 Kudos
Message 6 of 9
(4,973 Views)

Hi mechranjan,

 

Oh, I see, the picture was awesome.  Well, you're going to have to continue to use at least one X channel and one Y channel to specify these vertical lines.  What you need to do is add the X value (10) and the minimum Y value for the vertical line as row 1 in these channels, then add the same X value again and the maximum Y value for the vertical line as row 2 in these channels.  You can either create 2 more channels for the vertical line at 20 and repeat, or you can re-use the first pair of X and Y channels and simply add a Null for X and a Null for Y in row 3 and then use rows 4 and 5 for the two XY points you need for the second vertical line.

 

Ask if you have questions,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 7 of 9
(4,953 Views)

Thanks Brad. i tried that but an XY plot doesnt plot 2 X channels. In the case i can either plot my vertical lines or the data graph with the time channel. If i plot the data graph then the vertical line, the data graph disappears. Im using diadem 8.1 (thats the 1 my office has), so is the problem with the version or am i doing something wrong?

0 Kudos
Message 8 of 9
(4,942 Views)

Hi mechranjan,

 

Even DIAdem 2010 (11.2) only allows one X channel per curve-- so nothing has changed there in the last 10 years or so since you bought a DIAdem license.  What I'm suggesting is that you you create one curve for the data and a second curve for the vertical lines.  If you don't use the Null suggestion, you'd also need a third curve, with the second and third curve each defining exactly one vertical line.  You can have multiple curves on the same 2D graph, so I'm suggesting you define multiple curves on the same graph to get the overal effect of data plus vertical target lines.  This should work fine in DIAdem 8.1.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 9 of 9
(4,936 Views)