02-27-2010 07:39 AM
02-27-2010 09:59 AM
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
02-27-2010 04:05 PM
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
03-01-2010 02:43 AM - edited 03-01-2010 02:44 AM
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 andGetCurrentDateTime 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.
05-13-2011 09:24 AM
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.