Showing results for 
Search instead for 
Did you mean: 

How to link Excel Chart with multiple columns dynamically?

Hi all,

I have one problem. I have an excel chart which has to read data from multiple columns for it's X-axis values (time stamps) and the same number of values for it's Y-axis from multiple columns. See figure attached.

Now, you can do this by manually assigning values by holding control key to tell the chart that data from many columns is continued from the first column. i.e, a long data is distributed along may columns. This is done very easily manually.

Now, how to do it at runtime through LabVIEW 8.0?

Although, I have done it through labview when there where only two columns, A and B streching up to any length. But, now to save space we are dumping into many columns in the same page and want the chart plot that data as we dump it. 

It is tough since I don't know how to assign SourceData of the chart through labview.

I have attached chart's SourceData picture.

Hope you all can solve my problem.

The Y-axis values are: =(good!$B$30:$B$70,good!$D$30:$D$70,good!$F$30:$F$70,good!$H$30:$H$70,good!$B$71:$B$140,good!$D$71:$D$140,good!$F$71:$F$140,good!$H$71:$H$140,good!$B$141:$B$189)

good is the name of the file.

The X- axis values are: =(good!$A$30:$A$70,good!$C$30:$C$70,good!$E$30:$E$70,good!$G$30:$G$70,good!$A$71:$A$140,good!$C$71:$C$140,good!$E$71:$E$140,good!$G$71:$G$140,good!$A$141:$A$189)


See the columns vary from A to F.


I have still not got what I love.....
Download All
0 Kudos
Message 1 of 12

Are you asking how to do it using ActiveX, or how to use ActiveX to control Excel?


If it's the former, you need to use SetSourceData method. You can record a macro that does what you want and look at the macro code to see what you need to do. You can also search the web to find example code.


If it's the latter question, then you should start by looking in the LabVIEW Help at the topic "Using ActiveX with LabVIEW". You can also take a look at the KB article ActiveX and LabVIEW. There are also shipping examples for Excel. There is also the Excel thread with lots of examples.

Message 2 of 12

I know how to use ActiveX. But, the thing is, since it is running in to multiple columns I dont know how to set SourceData for many columns.

I will try the macro recording thing. Maybe I might nail something! Anyway, I will look into those excel areas you have given. 

Thanks man.. smercurio_fcSmiley Happy

Message Edited by Halemani on 09-19-2008 12:20 AM
I have still not got what I love.....
0 Kudos
Message 3 of 12

Ok i solved the excel chart problem. Here is the figure showing my victory! But offcourse with NI forum help.Smiley Very Happy



Message Edited by Halemani on 09-19-2008 06:33 AM
I have still not got what I love.....
0 Kudos
Message 4 of 12

But, stuck with another problem!

I am not able to name chart's X-axis and Y-axis. 

Here is the figure,


 Variant To Data

Message Edited by Halemani on 09-19-2008 06:40 AM
I have still not got what I love.....
0 Kudos
Message 5 of 12
What exactly is the problem?
Message 6 of 12

Sorry about that. Theerror is related to converting the variant to data.

The error code is "Error -2147352571 occurred at Variant To Data"

I will try it in  NI error database. Just in case you can find out about the wiring issue. Maybe I have wired wrongly. 

I have still not got what I love.....
0 Kudos
Message 7 of 12
You seem to be trying to cast a ChartArea object to a Chart. Those are two diferent objects, and I don't believe you can cast a ChartArea object to a Chart object.
Message 8 of 12

Hi Folks,


I am trying to add new series into a Excel chart dynamically using ActiveX and ran across this post. According to "Microsoft Office Excel 2003 Visual Basic Reference" (vbaxl10.chm), there exists a NEW Series method for Seriescollection object. However, after casting type the seriescollection, I can only find the available methods as follows:

Add, Application, Extend, Item, Paste.  


I did not see the NEW Series method as shown in this post. Please help how to wire this "new series" method.


thanks much!



0 Kudos
Message 9 of 12

Odd. I see it:




How are you creating the SeriesCollection object?

0 Kudos
Message 10 of 12