LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot a bitmap behind the grid

Hello,

I want to use a bitmap (*.bmp-file) as background for a xy-graph. If I use the PlotBitmap() function, it plots the bitmap over the grid. But I want to see the grid-lines over the bitmap.
Is there a solution on how to do this?
I tried to create a picture control behind the graph, and then make the plot-area transparent. But it doesn't work. I tried it on Win2000 and WinXP.
Furthermore the bitmap should be zoomed against to the plotted graph.
I would be pleased if someone could give me a hint.

Martin
0 Kudos
Message 1 of 4
(3,374 Views)
Martin,
 
Placing a transparent graph on top of a picture control *should* work. Keep in mind that you will have to make two things transparent in the graph: the plot area, and the frame (ATTR_PLOT_BG_COLOR and ATTR_GRAPH_BGCOLOR). But if you do that, then you should be able to see the picture control behind the graph. Let me know if this doesn't work for you.
 
If you need to zoom the bitmap, it might be easier if you use a canvas control instead of a picture. A canvas control allows you to draw the bitmap programmatically using whichever scaling factor you chose. Use the CanvasDrawBitmap function.
 
Luis
NI
 
 
0 Kudos
Message 2 of 4
(3,369 Views)
Ok, I only made the plot area transparent. If I make the frame transparent too, than it works.
Another idea I had was to plot lines after plotting the bitmap, to redraw the missing grid.

But there is another problem, that I'm not able to recognize the zoom of the graph. There is no event which tells me, that a user zoomed the graph using the CTRL-key and the mouse. So I can't redraw the lines (or rescale the bitmap) when it is neccessary. Is there a way to recognize this? Or have I to write my own zoom-routine, and not to enable zomming in the graph properties?

Thanks in advance,

Martin
0 Kudos
Message 3 of 4
(3,356 Views)
Martin,
 
You're right. Events from graph zooming is a piece of functionality that is definitely missing from the graph. It's in our short-term wish list, and we hope to put it in one of the next versions of CVI.
 
In the meanwhile, you have two options. One is to implement zooming yourself, as you mentioned. You can do that by adding two graph cursors that define the new range, and then ask your user to click on some button so that you can set the new range. The other option, that is a bit CPU-intensitive, but might work for you if CPU-usage is not a concern, is to add a timer control to your panel, and in the timer's callback check the axis range, and whenever it has changed from the last time, you would rescale the bitmap.
 
Luis
0 Kudos
Message 4 of 4
(3,339 Views)