11-28-2014 08:26 AM
Another day, another problem.
I'm currently writing a holy grail tool for our UI development and have run into a problem. How do I add an X-Scale or an Y-Scale to an existing graph programatically?
I can iterate through the existing scales and store all relevant information from them but when I want to apply these infos to a target graph (regardless of type) I have hit a brick wall with regard to adding scales.
With sliders this was mush easier because we have the "Add slider" and "delete slider" methods.
Anyone have any ideas?
Scripting allowed.
Shane.
11-28-2014 08:39 AM
Can't find any way to do it from property/invoke nodes.
Perhaps create 10 scales (or as many as you'd realistically need), set them all Visible=False and then only show/set the properties of the ones you want?
11-28-2014 08:42 AM - edited 11-28-2014 08:46 AM
Seems like the only way. It's a bit of an ugly workaround, but whatever. Even if I was able to delete the scales I could start with a silly number (16 or so) and delete the ones not needed. I must try actually deleting scales to see if that works. I don't like the idea of graphs in production code (sold software) with zillions of scales when it only needs a few.......
Shane
Ps Nope, deleting doesn't seem to work.... Bugger.
This is a big hole in my design.
11-28-2014 08:43 AM - edited 11-28-2014 08:44 AM
Unfortunately it's the same for tabs in a tab control.... 😞
12-01-2014 07:50 AM
Unfortunately, there is no way to do this short of adding multiple scales to a graph, then hiding them until needed. Be careful with this strategy, however, as it can lead to performance issues. Each added scale degrades performance.
Another, possibly overkill, strategy is to place your graph in a standalone VI that is hosted in a subpanel. You can then create graphs with various numbers of scales and instantiate the one needed when needed. You can also swap them out in a seemless fashion. Unfortunately, it is a lot of code.
If you create a suggestion in the Idea Exchange for this, I will vote for it. It may already be there.