From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to multiple YAxis programmatically in BCB 4, but don't run...

I have several plots,so I want to create 2 YAxis in real time.

In CWGraph's wizard, I set 2Plot and 1xaxis, 2 yaxis .
In this case, multiplot run.
But create 2plot and 2 yaxis in programmatically.
In this case, multiplot don't run.

My programm coding's list are below.

CWAxesDisp cwaxes;
CWAxisDisp YAxis1,YAxis2;
CWPlotsDisp plots;
CWPlotDisp plot;

Variant index;


//set axes style
cwaxes = CWGraph1->Axes;
cwaxes.RemoveAll();

index=2;
YAxis1= cwaxes.Item(index);
cwaxes.Add();
index=3;
YAxis2=cwaxes.Item(index);

//Add YAxis2 at plot-2
index=2;

plot=plots.Item(index);
plot.YAxis=YAxis2;
plot.set_MultiPlot(true);
YAxis2.set_AutoScale(true);

// Plot Data
Single cal;
Variant data(OPENARRAY(int,0,1,0,99)),varSingle);


unsigned i;
for (i=0;i<100;i++){
cal=(Single)i*i;
data.PutElement(cal,0,i);
cal=(Single)i*2.0;
data.PutElement(cal,1,i);

}
CWGraph1->ClearData();
CWGraph1->PlotY(data);
0 Kudos
Message 1 of 2
(2,719 Views)
I have no experience with Borland Builder (it is not an officially supported environment for the use of the ComponentWorks ActiveX controls), but there is a shipping example documenting the use of multiple y-axis in VC++ (attached). Try comparing your code to this example. If you still feel you are coding this correctly, run a search for "borland support" from www.ni.com/support. There are a few good KB's with some tips and tricks for using these components in Builder.

Hope this helps,
Eric Meyer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,719 Views)