LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

activeX and Excel Charts

I am currently using LabVIEW 6.0.2 on a WIN98 Machine with Office97. The problem I seem to have is with a chart. I have a chart template created and saved as an XLT file for Labview to call. I then write 401 points of data to the page that is linked to the chart. The chart basically frequency vs amplitude. Y-axis for Amplitude ans X-axis for Freq. the Amplitude is always -4 to 4 and the frequnecy changes, in one instance it is 5.85-6.425 and the chart x-axis range is 5.80 to 6.50 which is great. but when the frequnecy is changed to 5.85 to 7.10 the chart range if 0 to 8. If I could find a way to programmatically change the range I would but I don't see anything. Right now thw Office tool kit is not an option as I am still trying to get the company I am at to upgrade to LV 7.1. if I remove point of data from the middle the chart range shows the same. as it fills the data I can watch it shift from the left but I am not sure how to fix it..

Attached is a zip file with the 2 charts I am describing

Thanks
Jeff
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

Message 1 of 18
(5,014 Views)
Here is a subvi from my own tools that sets the scale on a chart to specified values. It also sets the Chart Title. You will need a reference to the chart to run this vi.

If it shows a broken arrow for you, just right click on each property node and reselect the same property. This will adjust the ActiveX links for your version of MS office.

Michael Munroe
Certifield LabVIEW Developer
www.abcdef.biz
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 2 of 18
(4,973 Views)
Thanks I will try it tomorrow.. one question is will it work if the Chart is just on a excelc page with other data?
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

0 Kudos
Message 3 of 18
(4,969 Views)
Yes, it will work on ChartObjects and Charts. I frequently create several charts on one sheet aligned corner to corner. Then I update the data from the analyzer and set the scales for each chart. You can then control exactly how loose you want the scale to fit.

Michael
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 4 of 18
(4,967 Views)
Okay,

I am looking at the ActiveX components, Please forgive me as I am still and ActiveX rookie, but which activeX property do I use to connect to the VI of yours?

The Workbook property has Charts listed and the Worksheet has nothing.. I would think it would be the worksheet property since the chart is embedded on a page with other data, but I cannot seem tot find the correct property to use..

Thanks
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

0 Kudos
Message 5 of 18
(4,960 Views)
I think I am getting closer. i found the ChartObjects Method on the Worksheets invoke node. It seems to find the chart by wiring the index to a 1. But I am having trouble getting the correct output from the Variant.. I am using a Variant to Data VI but cannot seem to get the correct input Type to set the output Data properly. The variant Value is shown as 'Value -> 9BA9D8' when I stick a probe on the ChartObjects output. I have tried the set the Type to the Excel_Chart Refnum but I get the following error: Code 1: Incorrect function.in my VI.

Attached is a jpeg of the code area, I am adding data in that for loop before I want to change the chart. That data from the for loop goes in cells around the chart, not in it.
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

0 Kudos
Message 6 of 18
(4,948 Views)
That is one of the difficulties of ActiveX. There are too many steps to get where you want to go.

As is almost always the case, when you use Item to select a member of a collection (plural ChartObjects), the variant must be converted to a reference to the singular (ChartObject). That reference to ChartObject needs to feed another Property Node set to Chart. That is the reference you need.
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 7 of 18
(4,942 Views)
Thank you Michael,

I knew I was getting close but I was not quite there. it is moving farther along but I do get an error when using your VI. I know it is something I am feeding into it I think.

I am getting a type mismatch error from the first Invoke node in the Vi you sent. the error is -2147352571, Type mismatch. I tried all three types in the control with no luck..
Attached is my code (thrown together to test by itself) The xls Sheet is acutally a template (for the main program it is a XLT file) . this way you can see what i am missing..

Thanks again
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

0 Kudos
Message 8 of 18
(4,940 Views)
I GOT IT!!!!!

Thanks again for all you help Michael.. the problem I was having was in setting the AXIS Type. I had found some other VIs from Searching the site from others with similar questions, well most were in LV7.0 so I opened them at home with my Student editiona dn found that in some cases the AXIS type is set to a 1 or 2 (I16) so I tried that this AM and it works great.

Thanks again for the VI to do what I was looking for...

Jeff
Jeff D.

Certified Architect LabVIEW Champion DQMH Framework

0 Kudos
Message 9 of 18
(4,920 Views)
Im still confused how you guys are pulling the ref num for the chart out of these nodes??

Ive tried pretty much every combination of Invoke Node, property node, and used ChartObjects, ChartObject, Chart, Charts.... all I want to do is change the title of my chart.

I've looked at the VI that was posted above that requires a chart ref num... but how the heck do I get the chart ref num from?

Is it off the workbook or worksheet?

GRRRRR, very aggrivated. Im sick of searching through endless heirchies of ActiveX garbage!!!! Smiley Mad

Message Edited by MJBrehm on 08-17-2006 03:01 PM

Message Edited by MJBrehm on 08-17-2006 03:03 PM

0 Kudos
Message 10 of 18
(4,421 Views)