LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Excel Automation graph line color

What I want to do is get my user settable stripchart line colors of my application and set my Excel report graph line colors at the same value.

I'm sure it's nothing complicated, but I simply can't find the way to do it. So here is my question.

Can we and how do we modify graph line color through Microsoft Excel Automation (ActiveX)?

I'm using Labwindows/CVI 6 and Excel2000.

Francis Savaria
0 Kudos
Message 1 of 7
(4,259 Views)
Hello
You main reference source should be the MSDN, they describe all the api for the Excel automation object. Check out the help for the border object, this should give you what you need.

I hope this helps

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 7
(4,259 Views)
Hello

You main reference source should be the MSDN, they describe all the api for the Excel automation object. Check out the help for the border object, this should give you what you need.

I hope this helps

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 7
(4,259 Views)
You only need a couple of functions, one of which is tricky. If you have the Automation Reference to the Chart, wire up the following, cascading each output to the input of the next:

Method Node->Series Collection, select which series
Variant to Data, top input is Automation Ref set to Series
Property Node->Border
Property Node->Color Index, Change to Write, set the color.

Michael
http://www.stitchofclass.com
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 7
(4,259 Views)
Extremely useless
How about tell us how to replace dot operators in the firstplace !
0 Kudos
Message 5 of 7
(4,259 Views)
I have the same problem but your solution cannot be used in CVI , or at least I can't figure it out.

Here we need to make Excel automation but found no interface data on how to use the msdn help and call the NI functions extracted from the activeX wrappers.

We managed through trial and error to make quite a few more routines more than were shown in the example in CVI .

Trying to use SetProperty but it seems like some functions in the wrapper (recognised through the fp) did not work at all. All examples found did not show an educative approach to how to use the information to make a flexible program from Microsoft's documentaion to CVI
0 Kudos
Message 6 of 7
(4,259 Views)
The examples do actually give you a good approach to see how in CVI things are done with ActiveX. Then the Excel documentation shows you how to do it things specifically with Excel. From Excel's documentation, you can find out that to do this you need to:

1) From the chart, get the series object from the chart that you want to work with. This is done with the SeriesCollection function on the Chart object.
2) Get the property of the Series called Border which controls line styles.
3) Change the properties of the Border object to change the plot characteristics.

From the CVI examples, you can see that to call a method on a object I need a handle to the object and I need to find the function in the Excel ActiveX controller driver. In
this case, step one would look like:

Excel_ChartSeriesCollection (hChart, NULL, CA_VariantInt(1),&hSeries);

where hChart is the object handle to the chart that you want to work with, and hSeries is the handle to first series (index 1) in that chart. Next, in CVI to get a property of the series for step 2, you use the GetProperty function. We want to get the Border property which would look like this:

Excel_GetProperty (hSeries, NULL, Excel_SeriesBorder, CAVT_OBJHANDLE, &hBorder);

where hBorder is the handle to the Border Object. Now you are ready to set properties like line color and style. You would use the SetProperty function and set any of the Border object properties. For example, to set line color, something like:

Excel_SetProperty (hBorder, NULL, Excel_BorderColor, CAVT_VARIANT, VariantColorVal);

where VariantColorVal is a VARIANT that holds the color data. Help for the values to be used with color will be in the Excel documentation.

Hope that helps.


Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 7 of 7
(4,259 Views)