LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create histograms in Excel: one plot with different colors??

Hello,
here is my problem, I want to create an histogram in an Excel file with a color for each bar (each column of the table) I used the  function "plot colors" in which I introduced an array of colors as a parameter, but it only uses the first color of the table.
I joined the VI with a screenshot of an example of the histogram that I would like to have.
cordially,

Download All
0 Kudos
Message 1 of 10
(4,934 Views)

can you help me find a solution Please, it's urgent

0 Kudos
Message 2 of 10
(4,906 Views)

I think that the easiest way for you to do this would be to create an Excel Macro that changes the Graph the way you want it. Then just add the data and run the Macro. Look in the examples to find how to run an excel macro. For more information and some sample VI's and tool kits, you can go to the excel board




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 3 of 10
(4,888 Views)

Thank you for your answer, is there a way to do it using the Report Generation Toolkit or any other labview's function ?? 

cordially,

0 Kudos
Message 4 of 10
(4,878 Views)

The reason it is not easy to do this in LabVIEW is that ... it is not easy to do this in Excel!  How did you do this for the Example you showed?  It looks, to me, like this involves a fair amount of "manual labor".  If there is not an automated way to do this in Excel, then there won't be LabVIEW "hooks" into Excel to do this, either.  You are almost certainly going to have to either (a) do this manually in the Workbook after LabVIEW makes the Chart, or (b) figure out an Excel Macro that you can call (i.e. "Write an Excel Program") to do this for you.

 

Bob Schor

Message 5 of 10
(4,872 Views)

Thank you

I agree with you that it is not easy to do on LabVIEW, I spent all morning trying .However it 's not as difficult on Excel I just check the option (on yellow) in the attached screen capture,
any way thank you  for you answer and I'll  thought of one of the solution that you mentioned,

if you have examples that can help me I would appreciate 

cordially 

0 Kudos
Message 6 of 10
(4,856 Views)

What Bob is suggesting is to do it in Excel.  Record a macro while doing it.

 

Then either:

see how the macro does it and replicate it in LabVIEW.

or

Just have LabVIEW execute the macro you recorded in Excel.

 

Message 7 of 10
(4,836 Views)

Not an obvious task for sure. The MSGraph documentation is VERY limited. The count property of the Points collection doesn't seem to work so you need to feed the function I created with the 2D array used to create the graph.

 

I attached a vi that do what you want, a test.vi to test it and an the Excel workbook I used for validation.

 

NOTE: When you post to the forum you should always save the controls with default typical values, it would help people help you.

 

 

 

Ben64

Download All
Message 8 of 10
(4,774 Views)

 

I like Ben's Solution, as it works in conjunction with the RGT, but "hides" the messy details.  It would have been nicer if you could create the Histogram with the RGT and then call a function like this just to change the Column colors, but Ben seems to say that this may not be possible.  I'm (almost certainly) not as facile with ActiveX as he is, so I'll defer to his opinion, but (as Christine would say) tant pis.

 

Bob Schor

0 Kudos
Message 9 of 10
(4,766 Views)

Can not open 2015 VIs (I am 2011). Do you have access to chart activeX refnum there?

Excel chart has "apply chart template" method - requires template.crtx file name only.

 

0 Kudos
Message 10 of 10
(4,741 Views)