LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

best way to draw (not plot) on a graph?

Solved!
Go to solution

Hi -

 

I need to alter the appearance of a graph somewhat. The user doesn't want any full grid lines, but he does want a small crosshair (like a plus sign) drawn in each of the four quadrants. The CanvasDrawLine() function would be good for this, if it worked on graph objects, but it doesn't. I guess I could use bit files, but...is there an easier/better way?

 

EDIT: after reading a little more on bit maps, it's not clear to me that these will work, either. So...any other ideas at all?

 

Thanks.

0 Kudos
Message 1 of 5
(3,313 Views)

I decided to use the PlotPoint() function with VAL_CROSS. This isn't ideal, as I have to redraw the crosses whenever I erase the graph, but it's good enough. If anyone knows of a clever way to do this (retain the crosses while erasing the data plots), I'm interested to hear about it. Thanks.

0 Kudos
Message 2 of 5
(3,299 Views)
Solution
Accepted by topic author mzimmers

I have two comments/suggestions:

 

  • you don't need to erase the full graph (your plot handle parameter of -1) but you can simply delete the individual plots (using the individual plot handles) keeping your crosses. Simple and does what you want, all you need to do is some bookkepping of the plot handles
  • keep in mind that you also can have a transparent background of the graph. If, for example, your axis range is constant, you could use a suitable bitmap behind the graph control
Message 3 of 5
(3,295 Views)

Going on the line of wolfgang suggestion, you could also have two graphs one on top of the other. The lower one can have all fixed elements (scales, axes, crosses and so on), while on the upper one, with transparent background, you can draw / erase your data plots. As long as you keep axes for both graphs with the same scale the system works like a charm, and you don't need to struggle with pixel conversion between the graph and the picture.



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?
Message 4 of 5
(3,289 Views)

Those are both good suggestions. I opted for the route of keeping a list of the non-cross plots, and deleting from that list only. Seemed easier than creating a bitmap or a second graph (which I would still have to doctor).

 

Thanks.

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