LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I customize Excel plot area and axis settings using Report Generation Toolkit?

Solved!
Go to solution

I am using the Report Generation Toolkit to create an Excel worksheet. In it, I export my data table and create some XY-scatter plots. Everything works fine, except two things:

1. Both the chart and plot area colors only work with some of the colors that I choose but not others

2. The x-axis marks appear in the middle of the chart (for those charts where y-axis include both positive and negative values)

 

For the first problem, for example if I choose a darker shade of green it works, but a lighter shade does not, and the plot area color instead appears as grey. 

For the second problem, I cannot see anywhere under the Chart Property Node any settings for x-axis and y-axis. What am I missing? 

Download All
0 Kudos
Message 1 of 20
(4,852 Views)

I could be wrong, but I think that Excel Graphs are Excel objects, and cannot be (easily) converted to LabVIEW Objects, which means you cannot use LabVIEW's Chart properties to modify them.

 

The RGT is designed to give you basic functionality and "hooks" into Excel.  If you need to get "very fancy", you can try to write ActiveX code to modify some of the more esoteric Excel properties, such as Axis settings.  However, you might find it easier to create a VBA Macro in Excel that does what you want and execute that Macro (it seems to me that I saw someone do this once -- took me quite a while to figure out what he or she was doing ...).

 

Bob Schor

0 Kudos
Message 2 of 20
(4,808 Views)

Thanks Bob.

Any thoughts on why the plot area colors don't match what I select?

0 Kudos
Message 3 of 20
(4,802 Views)

@murchak wrote:

Thanks Bob.

Any thoughts on why the plot area colors don't match what I select?


No, I have no idea why it didn't work for you.  It's late, I'm tired, so instead of trying your code (which does lots of stuff, some of which seems wrong to me), I used a simpler routine (search the Forum for "Revised Example" to find a Revised Excel Example I wrote several years ago) and had no trouble changing the Graph and Plot Area colors, as well as the colors of the individual lines.

 

Bob Schor

0 Kudos
Message 4 of 20
(4,793 Views)

Thank you Bob.

 

Whenever you get a chance, can you please save your example as a 2011 version? 

0 Kudos
Message 5 of 20
(4,786 Views)

@murchak wrote:

Thank you Bob.

 

Whenever you get a chance, can you please save your example as a 2011 version? 


I did a Save for Previous Version to 2011.  Can't test it here as I only have 2016 on this machine ...

 

BS

0 Kudos
Message 6 of 20
(4,779 Views)

The RGT uses the ugly OLE objects, which are not the standard charts that you would insert when using the Excel app.  However, it is possible to use the nicer looking charts that may offer a little more flexibility in customization.  In this thread, I posted code to insert one of these charts.  Play around with the property nodes for the chart object and see what you can come up with. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 20
(4,741 Views)

@murchak wrote:

I am using the Report Generation Toolkit to create an Excel worksheet. In it, I export my data table and create some XY-scatter plots. Everything works fine, except two things:

1. Both the chart and plot area colors only work with some of the colors that I choose but not others

2. The x-axis marks appear in the middle of the chart (for those charts where y-axis include both positive and negative values)

 

For the first problem, for example if I choose a darker shade of green it works, but a lighter shade does not, and the plot area color instead appears as grey. 

For the second problem, I cannot see anywhere under the Chart Property Node any settings for x-axis and y-axis. What am I missing? 


1. The embedded chart inserted by the RGT is not an Excel object but an MsGraph object. The MsGraph chart has a very limited color palette (56 values). You can select any RGB value but MsGraph will match it to the closest of its existing palette value (in some case to a grayscale). You can see these colors if you activate a chart, right click it and select Format Chart Area (not sure about the actual English name my excel is not in English).

 

2. You can access axis properties and method with the Chart Axes method, see below.

 

Ben64

ScreenShot012.png

0 Kudos
Message 8 of 20
(4,740 Views)

Thank you aputman. I looked at your example, but I cannot find Excel.Chart object. I put a property note on the block diagram, and right-clicked on the Property -> Select Class -> ActiveX -> and here I don't see Excel._Chart, I only see Excel._OLEObject, Graph.Chart, etc. but not Excel.Chart. Anyway, I have Labview 2011. Is this the reason? Or is Graph.Chart the same as Excel.Chart?

0 Kudos
Message 9 of 20
(4,727 Views)

Thanks Ben.

 

What is the procedure for creating a Graph.Axes object from scratch so I that I can connect it to the Variant to Data type input?

Sorry my OO programming skills are pretty weak.

0 Kudos
Message 10 of 20
(4,719 Views)