DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating graphics using multiple channels for measurements and one other unique channel for datetime.

Solved!
Go to solution

Hi everyone,

 

I'm using Labview and DIAdem to create graphical reports and i'm using the connectivity VIs and not the Express VI.

 

The data is stored in a MySQL Inno DB.

 

 

I'm using the following command to get the data that i want to show in the graphical report! 

SQL_ExecDirect("select `TimeStamp` , `Value` from `TableX` where and Sample='%s' and Channel='%s';") 

 

And then I use:

SQL_BindChannel("Datetime1C1" , "TimeStamp" , "t","#yyyy-mm-dd hh:nn:ss") to bind the data for X axe of the graph.

And after that I use:

SQL_BindChannel("SampleN","Value","n") to bind the data for the Y axe of the graph.

As I want to create the graph with more than one Sample, I use the commands above on a loop.

 

Now here is a printscreen of my problem.

 

23422i41999B1CB8652410

 

In the first Iteraction( green line), DateTime1C1 has the timestamp for sample1 but in the second Iteraction (yellow line) DateTime1C1 has the timestamp for sample2, in the third iteraction (Blue Line) DateTime1C1 has the timestamp for sample3. etc.

   

The original timestamp for each sample are "lost"  it re-writes datetime1C1. and in the end it show only the timestamp for the 5th iteraction.

 

How can I create a graph with multiple lines (Samples) and one unique datetime axe?

 

Thx in advance

 

0 Kudos
Message 1 of 5
(4,357 Views)
Solution
Accepted by topic author AlexandreHSCastro

Hi AlexandreHSCas,

 

If I understand your situation correctly, the only thing you need to change is to create a new Group in the DataPortal before each query.

 

FOR i = 1 TO iMax
  NewGroupName = "Query " & i
  Call GroupCreate(NewGroupName)
  Call GroupDefaultSet(GroupCount)
  Call SQL_ExecDirect("select `TimeStamp` , `Value` from `TableX` where Sample='%s' and Channel='%s';")
  Call SQL_BindChannel(NewGroupName & "/Datetime1C1" , "TimeStamp" , "t", "#yyyy-mm-dd hh:nn:ss")
  Call SQL_BindChannel(NewGroupName & "/SampleN", "Value", "n")
NEXT

Then you can just drag each Group from the Data Portal onto the same XY graph-- because each Group has its own time channel, the data points will show up correctly placed on the common X axis of the graph.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(4,344 Views)

I'm gona give it a try!

Thanks Brad

0 Kudos
Message 3 of 5
(4,340 Views)

Hi Mr Turpin !

 

the solution you provide has worked. thanks.

 

Now I have this "issue" I created a TDR with 2 scales... one on the left and the other on the right! In order to be able to analise (in the same graphic) several "Current" measurements plus a temperature measurement.

 

I want to put the current measurements on the left left scale and the temperature measurements on the right scale.

 

Can you or any other forum user help with that?!

0 Kudos
Message 4 of 5
(4,229 Views)

Hi Alexandre,

 

Sure.  Each Y axis you create can be placed either on the left side or the right side of the graph, and each curve can be assigned to whichever Y axis you choose.  So you just need to open the "Curve and Axis Definition" dialog for the graph, go to the "Axis Position" tab, then in the first "Reference" column choose "Axis begin" for the current Y axis and "Axis end" for the temperature Y axis.

 

Brad Turpin

DIAdem Product Support Engineer
National Instrumets

0 Kudos
Message 5 of 5
(4,215 Views)