Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

change graph background image dynamically

Hi,

I'm plotting 2 simple XY-graphs, and i use a bitmap background on each.  when the user clicks a button, i need to redraw the bitmaps (taken care of with seperate code) and then update the images for my graph backgrounds.

How do you update the background plot images? (for that matter, how do you set the images to the background?? .. right now, i'm just using the VC++ wizard to start out with the right image).

Thanks,
Ryan
0 Kudos
Message 1 of 5
(3,970 Views)

Hi superryan007,

What type of graph are you using to create your XY graph? Is it the CWGraph, ScatterGraph, WaveformGraph? Each has different properties for setting background images and this information would be helpful. Thanks

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 5
(3,951 Views)
Hi Jonathan,

I'm using CWGraph.

Thanks,
Ryan
0 Kudos
Message 3 of 5
(3,938 Views)

Hi superryan007,

All of the properties and methods available for CWGraph, ScatterGraphs, and WaveformGraphs can be found in the NI Measurement Studio Help. Browse to Start >> All Programs >> National Instruments >> Measurement Studio 7.1 for VS .NET 2003 >> Measurement Studio Documentation. Then select the Index tab and type in scatter graph and choose ScatterGraph Members. All of these properties and methods are available for CWGraph as well. If you scroll down the list, you will see a Background Image property. You can either set or get the background image of the graph.

This background image property sets or gets the image to display in the background of the control.  Below is the syntax I copied from the Help. 

public: __property virtual Image* get_BackgroundImage();
public: __property virtual void set_BackgroundImage(
Image*);

Also, there is a bunch more properties you can mess around with.  For example, say your graph is called axCWGraph1. Then you could say axCWGraph1->get_BackgroundImage(Image variable name). 

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 4 of 5
(3,924 Views)

The CNiGraph (C++ equivalent of the CWGraph) has a Images indexer that you can use to access the plot area image

m_graph.Images(3)  //to get the plot area

This returns a CNiImage object to which you can assign your new picture by giving it a file path (using the URL property) or by providing it a CNiPicture object. See this post for how to create a CNiPicture if you have a HBITMAP

Bilal Durrani
NI
0 Kudos
Message 5 of 5
(3,919 Views)