From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot data in a diadem 2d-axis object using OLE ?

I've been trying to plot a simple xy chart in the diadem report panel via an OLE interface. I've managed to create the data channels, worksheets and a 2d-axis object, but havn't figured out how to plot the data channels.
Ideally I'm looking for some example code showing how to use the OLE toCommand/toDatasheet interfaces to create the 2d-axis object and plot one or more channel pairs,
cheers,
Aled 
0 Kudos
Message 1 of 3
(3,265 Views)

Hi Aled

How to modify or create an axis system is described in several articles of this forum, e.g. http://forums.ni.com/ni/board/message?board.id=60&message.id=3802#M3802

You ask how to modify it using ole. I attached a simple script that you can use as a base for you task. (For DIAdem 9.1)

Instead of using a reference to a channel with the syntax "[1]/[1]" you can use the names of the channels e.g. "[1]/Time" or "Example/Time"

Hope this helps.

 Winfried

Message 2 of 3
(3,251 Views)

Thanks winner,

I managed to get it all working, though it was not so straightforward as I was coding with Borland c++Builder.

Just for the record:

MyToCommand->TextVarSet(TOleString("D2ChnX"),Variant("[1]/[1]"));
MyToCommand->TextVarSet(TOleString("D2ChnY"),Variant("[1]/[2]"));

Produced an error message "incompatible types in assignment" in diadem, (TOleString is a class provided by Borland that takes a char* - necessary for compilation where a BSTR input is required)

So next I tried:

MyToCommand->TextVarSet(TOleString("D2ChnXName"),Variant("[1]/Alpha"));
MyToCommand->TextVarSet(TOleString("D2ChnYName"),Variant("[1]/CL"));

This added a curve to the plot but no data were plotted, the channel names assigned to the curve were "[1]/Alpha" instead of "Alpha" etc., so I guessed

MyToCommand->TextVarSet(TOleString("D2ChnXName"),Variant("Alpha"));
MyToCommand->TextVarSet(TOleString("D2ChnYName"),Variant("CL"));

And that worked fine

Thanks again

Aled

0 Kudos
Message 3 of 3
(3,242 Views)