Neil Pate Posted November 6, 2017 Report Share Posted November 6, 2017 Hi all, I would like to make a Bar Plot in LabVIEW with the slight difference in that I would like my columns to have a colour gradient to them. All my odd columns will have a certain colour + gradient,and all my even columns will have a different colour + gradient.Ideally also it would be nice to be able to animate the changing heights of these columns. I can probably do this by using the Graph just for the "frame" and axes etc and then manually drawing in the columns into the FG picture, but seems like a lot of work. In the attached picture the Graph is generated in LabVIEW (except the middle column I have pasted over from a different application). Ideally I would like to to this all natively in LabVIEW. The previous app was actually LabVIEW but I do not wish to use the old technique as it is very fiddly and totally bloats the application (hint, the column is actually a picture control), Does anybody have any suggestions? Quote Link to comment
GregSands Posted November 6, 2017 Report Share Posted November 6, 2017 My first thought - I wonder whether one of the 3D Graph (I find the old NI 3D Graphs a little easier than the rewrite) or 3D Picture controls might work - unfortunately there seems like there might be a fair bit more capability hidden out of sight than can be easily accessed. At the very least you might be able to appear like a bar has two different colours by an appropriate 3D Bar Plot, even if you don't get the gradient in between. 3D Picture controls are based on OpenGL, so theoretically it should be easy to do what you want there, but I've never had much success doing anything complex with 3D Pictures. Quote Link to comment
hooovahh Posted November 6, 2017 Report Share Posted November 6, 2017 I was going to suggest the 2D picture control anyway. I mean you probably can do some post processing like get the image of the graph, and then overlay an image of the gradient on top, but I don't think it is all that hard to draw a gradient bar. Attached is some code that does the trick and pulls code from the dark side. Gradient Picture Hooovahh.zip 1 Quote Link to comment
Neil Pate Posted November 7, 2017 Author Report Share Posted November 7, 2017 Thanks, I will give it a shot drawing on one of the Graph picture layers. Quote Link to comment
Popular Post hooovahh Posted November 7, 2017 Popular Post Report Share Posted November 7, 2017 Okay how about this. Attached is an example where you give an array of Bar Plot values, and a gradient graph is generated. It uses the gradient code I posted earlier, along with code to get the colors of the plot, and find their positions for replacing. It is somewhat robust in that the plot size and positions can change and the new gradient overlays should be placed in the correct locations. At the moment only positive values are supported. If you really wanted I think you could give the 3D look with some minimal effort. This is all using the picture control overlay feature of the graph, and on initial creation you can see the flicker between the normal solid bars, and then the overlays. Gradient Bar Plot.zip 3 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.