LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't plot absolute time data on X axis?

I need some help, I can't plot absolute time data on X axis, i found a method in an end but if i want to set  a point on X to make a grafic it doesn't work, it takes a bad value. If i use same method on Y axis it work ,  the help specific something about working only on Y axis for the strip chart, i need to work with strip chart cause I need the cursors.... if someone have a solution thank a lot.
0 Kudos
Message 1 of 5
(3,990 Views)

A strip chart doesn't permit you to plot anywere along the X-axis: every time you plot a point, it is added to the history and shown immediatley after the preceding points plotted instead. If yo want to plot at an arbitrary X point you need to use a graph instead of a strip chart.

Graphs accept date and time as values on the X-axis (see the linked CVI help topic, section "Specifying Dates and Times for Axis Values"), and have cursors too; CVI also ships with an instrument driver to improve cursor functionality



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,984 Views)

Thanks for answering! I've ploted it in a graph... from the begining, but i changed the name in STRIPCHART and i forgot,sorry.I don't know why it doesn't work

 

case EVENT_COMMIT:
             DeleteGraphPlot (panelHandle, main_panel_STRIPCHART, -1, VAL_DELAYED_DRAW);
            //transf data
            MakeDateTime (21, 12,12,1, 1, 2009, &aux);
            bufferLen = FormatDateTimeString (aux, DATETIME_FORMATSTRING, NULL, 0);
            dateTimeBuffer = malloc (bufferLen + 1);
            FormatDateTimeString (aux, DATETIME_FORMATSTRING, dateTimeBuffer, bufferLen + 1 );
   
            //transf data
            MakeDateTime (12, 0,0,1, 2, 2011, &aux1);
            bufferLen = FormatDateTimeString (aux, DATETIME_FORMATSTRING, NULL, 0);
            dateTimeBuffer = malloc (bufferLen + 1);
            FormatDateTimeString (aux, DATETIME_FORMATSTRING, dateTimeBuffer, bufferLen + 1 );
           
             SetAxisScalingMode(panel,main_panel_STRIPCHART,VAL_BOTTOM_XAXIS,VAL_MANUAL,aux, aux1);
                      
                
           
            GetCtrlVal(panelHandle,main_panel_Period,&x);
           
            PlotXY (panelHandle, main_panel_STRIPCHART, xval,yval, x, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID,1, VAL_RED); //xval and yval are 2 vectors with 20 val.           
           
            break;

 

 

The second way i tryied was using SetCtrlAttribute(panelHandle,main_panel_STRIPCHART,ATTR_XAXIS_OFFSET,aux1); - when i used this he set me the axis, but same problem when trying to set point on drawing graph.

Thank a lot

Message 3 of 5
(3,966 Views)

Depending on whict type of timing you want to display on the X-axis, you must pass the appropriate values both for axis range and for points to plot.

 

The online help I pointed you to before recitates:

If you use the absolute time format, LabWindows/CVI expects that you plot data that contains the number of seconds since January 1, 1900. This format is compatible with the format the time and

GetCurrentDateTime functions use. If you use the relative time format, LabWindows/CVI expects that you plot data that contains the number of seconds since some arbitrary point in time, commonly denoted as t0.

 

That is:

- To use absolute time you must pass the output of MakeDataTime to the graph

- To use relative time you must pass number of seconds

 

Take a look at the simple example I am attaching, which shows both axis scaling and graph plotting in both formats.

Message Edited by Roberto Bozzolo on 03-01-2010 09:44 AM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,936 Views)

Thanks guys,

 

What bought me here was a quest to discover the "MakeDataTime" function.

I blew a lot of time trying to get my dates from string to double.

Ought to be a link to that function in the CVI chart help.

0 Kudos
Message 5 of 5
(3,435 Views)