LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I have the y-axis units FLOAT and the x-axis units INT on a graph?

When I run the function PlotXY to graph data, I get both the x-axis and the y-axis units in floating point even though I specified the Xdatatype to be VAL_INTEGER and the Ydatatype to be VAL_FLOAT. Is it possible to have the y-axis use floating point units and the x-axis use integer units? Do I need to do anything special to make this work?

Thanks,
Donna
0 Kudos
Message 1 of 7
(3,458 Views)
Hi Donna,
I have not completely understood your question. When using PlotXY function you can pass the proper data type for x and y arrays and you get nothing back apart the plot handle.

What you may want to do is customize the aspect of the axis in case automatic adjustment does not satisfy your needs.

Can you explain with more details your question, please?

Roberto


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 7
(3,450 Views)
I am saying that eventhough I pass in an XDatatype of VAL_INTEGER and the xarray itself contains integers and is declared as an int, the graph that is displayed has as it's xaxis floating point units (ie. 1.0 1.5 2.0 2.5. The xarray that I pass in contains only integers, but the PlotXY function seems to automatically make it's own xarray values using floating point. I was thinking that this may happen because the yarray and the Ydatatype are floating point. Here is a copy of my call to XPlotXY.
PlotXY (pc_panelid, panelplusgraph, xarray, yarray, numPointstoPlot, XdataType, YdataType, VAL_THIN_LINE, // Plot Style
VAL_SOLID_CIRCLE, // Point Style
VAL_DOT, // Line Style
1, // Point frequency
the_color); // Color

Here is my function call to my function called GraphOneLine

GraphOneLine(pc_panelid, GEN_RES_P, GEN_RES_P_GRAPH2, (char*)the_title, (char*)the_xaxis_label, (char*)the_yaxis_label, VAL_INTEGER, VAL_DOUBLE, num_points, (int*)x_array, (double*)y_array, the_color, displayit, label_it, (char*)yLabel);

void GraphOneLine(int pc_panelid, int the_panel, int panelplusgraph, char graphTitlestr[], char xAxisNamestr[], char yAxisNamestr[],
int XdataType, int YdataType, int numPointstoPlot, int xarray[],
double yarray[], int the_color, int show_graph, int labelit, char* yLabel)
0 Kudos
Message 3 of 7
(3,438 Views)
As per the axis marks, it may happen that CVI automatically create a great number of divisions if there is enough room for them. Try setting the precision for the x-axis to '0': this way you should have no more fractional divisions on the axis.

Even without this, since you are using circles to mark points you should have all your circles grouped on integer values of the x axis: aren't they?


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 7
(3,436 Views)
Thanks for your response! How do I set the precision for the xaxis to zero? Do I do it in the PlotXY call or another call? When I graph, all of my points are connected with a dotted line so it is hard to see where the specific x array points are. THis is OK though, I just need to get rid of the floating point xaxis labels.
Thanks,
Donna
0 Kudos
Message 5 of 7
(3,433 Views)
You can set the precision of the x-axis either editing graph control properties in the UIR editor of programmatically with SetCtrlAttribute (panel, control, ATTR_XPRECISION, 0);

To have the evidence of the individual points plotted you must use VAL_SCATTER or VAL_CONNECTED_POINTS for Plot Style in PlotXY: in the first case only the points are plotted, in the second the line is plotted together with some of the points depending on Point frequency parameter. This can be useful to understand where points are, next you can switch back to VAL_THIN_LINE that hides the points.

Bye
Roberto


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 6 of 7
(3,426 Views)
Thanks Roberto, that worked!
Donna
0 Kudos
Message 7 of 7
(3,418 Views)