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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a secondary axis on a excel graph with labwindowsCVI?

Solved!
Go to solution

Hello,
I am currently working on LabWindowsCVI and I treat my data in excel files. I use ExcelReport and Excel2000 instruments to build my data tables and my graph. To trace, I use this function:
ExcelRpt_ChartWizard (chartsheetHandle, ExcelWorksheetHandle, "A1: C619" ExRConst_XYScatterSmoothNoMarkers 0, ExRConst_Columns, 1, 1, 1, "Consumption mobile plateform", "TIME (sec)", "Current / Voltage (in V & A in)" , NULL);
 
In this configuration, column A is X axis and B & C (Y axis) my respective data voltage & current.
My graph are traced correctly, but I find a problem, 2 curves are on the main axis and I want to trace one on the main axis and the other on the secondary axis. I can't to display a secondary axis.
Does this action is it possible with a LabwindowsCVI function and if so, can you tell me that function?
Thank you in advance,
Nicolas

0 Kudos
Message 1 of 4
(3,135 Views)
0 Kudos
Message 2 of 4
(3,112 Views)

Hi! nlepouliquen,

 

First of all, I believe you have two curves successfully plotted on the chart as you mentioned.  Excel asigns these two curves as data series 1 and 2 internally.  Assume you want to change series 2 to be plotted against the sencond Y-axis.  You can use the following two functions, defined in excel2000.c, to do it.

 

// select series 2 data

Excel_ChartSeriesCollection (chartsheetHandle, NULL, CA_VariantInt(2), &seriesTwoHandle);   

 

// create the second Y-axis and plot series 2 data against it

Excel_SetProperty (seriesTwoHandle, NULL, Excel_SeriesAxisGroup, CAVT_LONG, ExcelConst_xlSecondary);

 

 

0 Kudos
Message 3 of 4
(3,094 Views)
Solution
Accepted by topic author nlepouliquen

Thank you very much dcl9000,

I wrote these functions after to trace my graph and secondary axis appears :).  It was necessary to create a second chart handle to separate my both curve. Thanks to you, now, I know a new Excel function and I think I will need it in the future.

 

Regards,

Nicolas

 

0 Kudos
Message 4 of 4
(3,084 Views)