02-26-2017 06:28 PM
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?
Solved! Go to Solution.
02-26-2017 09:55 PM
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
02-26-2017 10:13 PM
Thanks Bob.
Any thoughts on why the plot area colors don't match what I select?
02-26-2017 10:33 PM
@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
02-26-2017 10:55 PM
Thank you Bob.
Whenever you get a chance, can you please save your example as a 2011 version?
02-26-2017 11:06 PM
@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
02-27-2017 09:31 AM
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.
02-27-2017 09:33 AM
@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
02-27-2017 11:10 AM
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?
02-27-2017 11:28 AM
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.