LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

question of plot and axis in CWGraph control

I want to creat several plots in a CWGraph control, each of them has their own name and axis.
I do it like this :
CWUIControlsLib__DCWGraphGetPlots (graphhandle, NULL,&plotshandle );
CWUIControlsLib__DCWGraphGetAxes(graphhandle, NULL,&axeshandle);
CWUIControlsLib_CWPlotsAdd (plotshandle, NULL,&plothandle);
CWUIControlsLib_CWPlotSetName (plothandle, NULL, name);
CWUIControlsLib_CWAxesAdd(axeshandle,NULL,&axishandle);
CWUIControlsLib_CWAxisSetName (axishandle, NULL, name);
CWUIControlsLib_CWAxisSetMinMax (axishandle, NULL,CA_VariantFloat(-10),CA_VariantFloat(10) );
CWUIControlsLib_CWPlotSetYAxis (plothandle, NULL,axishandle);
But it doesn't work. I found that each plot use the default axis, which is predefine in the graph contron named YAxis-1.
Thanks a lot !
0 Kudos
Message 1 of 5
(3,570 Views)
Hello good friends,

There's only one plot area for the CWGraph control. In other words, there is only one x axis in a graph control, and at least one y axis. You can therefore graph plots verses different y scales, but they will always be plotted on top of each other. For your application, it sounds like you should just use multiple CWGraph controls if you would like a separate x-axis for each y-axis.


Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 5
(3,546 Views)
Thank you for your answer! In my application, the plots share the same x axis and have their separate y axis with different scale. I found the scale of all y axies changed but the plot didn't change accordingly. I have attached my application example. Any ideal would be appreciated.
0 Kudos
Message 3 of 5
(3,536 Views)
Hello good friends,

I was able to reproduce the same issue you were seeing. I'm going to go ahead and file this as a possible issue (whether it be a lack of documentation or otherwise), and I will let you know what our findings are.

For now, as a workaround, you could create multiple CWGraphs to plot your data.

Thanks again.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 5
(3,525 Views)
Hello Good Friends,

In order to plot two graphs on one CWGraph using two different y axes, use the CWUIControlsLib_CWPlotSetByRefYAxis instead of the CWUIControlsLib_CWPlotSetYAxis function. We're setting an object reference, not actually setting it to a copy of the object.

I have attached an example program showing how to use this function.


Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 5
(3,493 Views)