UI Interest Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying intensity graph bounds

Solved!
Go to solution

Hi all,

I've created an actor wrapper to an intensity graph, that takes care of basic actions of the graph: resize, drawing, change settings, etc. I propose to use this GraphActor in a number of different places in my application: sometimes within a subpanel, sometimes in a separate window, sometimes large, sometimes small, and the crucial problem: sometimes with scales and sometimes without.

If the graph always has scales or always doesn't have them, resizing the plot area size resizes all the graph and everything is fine. However, if I have scales in some and not in others, making the scales invisible doesn't fundamentally change the plot area size (at least not when changing it programmatically) so I need to change the plot area size to fit the entire graph. When returning the scales, the graph again doesn't resize automatically, resulting in cut scales. The simple solution to this would be to change the actual bounds of the graph, not the plot area size, but it is read only.

In addition, if in one actor I set the frame color to pink and the scales to invisible, in the next actor launched the graph will be pink with invisible scales unless I specifically change it, even though this is not the default. I need to set the default parameters manually (by sending a setDefault message) to every actor I launch. So when I do have scales I need to calculate myself the plot area size so that the scales will have place. this is complicated, and if I change the font size at a later date it will change everything. To make things worse, if the previous actor was small, the new actor will have a small intensity graph (again, even though this is not the default). adding scales makes the actual data disappear completely, and I can't simply set the graph bounds to solve this

I tried creating a child class without scales, but it didn't solve the problem.

Does anyone have any idea how I can solve this? Any help would be appreciated.

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 1 of 8
(10,482 Views)

Hi Danielle,


I might be wrong on this but I think the intensity graph is also an X Control in itself with all of the above features modifyable. If you want to change things likethe plot area size then you can modify how this is calculated inside the X Control. I have modified a few things like this using 2D plots and graphs using this. So might be better to keep modifying the X control FG rather than the method as you are able to then state your criteria each time with regards to scales as you have more control.


I would take a copy of the intensity graphs in VI lib before you start modifying them, then it is very simple to just past them back as they are easy to break while testing your code.

Hope that helps.

0 Kudos
Message 2 of 8
(7,669 Views)

Hi,

Thanks for the quick answer!

I have absolutely no experience with XControls, so I didn't really understand what you are suggesting. You mean that I should modify the built in LabView control directly instead of using the property node? Where would I find the code of the intensity graph? would it be enough to make bounds writable and continue working as I am?

Is there really no other option?

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 3 of 8
(7,669 Views)

Hi Danielle,

Basically the fundamental code behind each of the 2D plots/graphs in LabVIEW are X controls. Ie. your front panel indicator is actually an X control. Therefore you can modify all of the code available as to how those graphs work by modifying the X Control which can be found in vi.lib. Ie. you can modify everything from plot area to graph size, to colour plots in the X control code itself which is the same as updating the properties. Just a little trickier. There are some things that the havn't supplied properties for which you can add into the X Control graph to make available. Not the simplest of jobs but once you get your head around how NI have coded it, it is pretty easy to understand and modify.

Might be better for me to get a jist of exaclty what is your trying to do as I might have already completed something similar. If you are able to get your head around actors and child classes you will have no problems with X controls. There might well be a simpler solution but worth noting you can modify those things as backup.

Happy to try and talk you through if required rather than emailing. Just ring the office number if you need and ask for Peter. UK number 0044 800 772 0795.

0 Kudos
Message 4 of 8
(7,669 Views)

I think it is only the 3D graphs that are XControls; the 2D intensity graph is not.

0 Kudos
Message 5 of 8
(7,669 Views)

Thanks AustinPeter for the advice. I might still give you a call...

Thank you drjdpowell, I couldn't find it

So that option is out. I have simply given up changing the plot bounds at all and I only change the plot area size, and set the frame color to invisible. this seems to work OK, except that sometimes Labview moves the Z scale ramp randomly, and sometimes randomly changes other parameters such as removing a pane from the actor front panel, moving the zscale ramp, changing the spacing needed for the xscale label, and more.  Why?

I basically wanted to write the code that resizes the intensity graph while maintaining aspect ratio + some code that handles functions such as selection of lines/rectangles etc. once, and reuse it all over my application. I did not want an XControl because I understood that they are slow and in some places I need the data to update rapidly. Wrapping it in an actor seemed a perfect solution, but this is driving me nuts...

Any ideas?

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 6 of 8
(7,669 Views)
Solution
Accepted by topic author dsavir

There are two properties on graphs for changing the plot area - Plot Area Size and Plot Area Bounds. Plot Area Size changes the size of the plot area AND the size of the entire graph/chart. Plot Area Bounds changes the size of the plot area within the graph without changing the graph bounds. This distinction will help you solve your problem, but the axis size issue remains. You can probably get this to work by looking at the size properties of your labels and changing the Plot Area Size and Plot Area Bounds appropriately.

Note that the reason you cannot change the graph size directly is that there are multiple things which can change the graph size. This is true of other controls, as well. There is always a way to programmatically change the size, but you may have to hunt to find it.

Let us know if you need more help.

0 Kudos
Message 7 of 8
(7,669 Views)

Thanks, I'll just keep at it

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 8 of 8
(7,669 Views)