07-19-2010 07:07 AM
Hello fellow users,
I've the following problem. I want to place different charts underneath each other because the charts (there are 4) resamble the same time frame and by placing them underneath each other it is easier to see what is happening. I've created a solution for this. A screenshot of the current situation;
I'm now using a cluster in which I placed the charts. On top off the cluster I have placed a scrollbar. With the scrollbar the position of the charts can be controlled. The position of each chart is being calculated by using the value of the scrollbar after which the calculated y coordinate is being given to the property nodes of the chart which control the position. VI snippet (or just download the VI, can be found at the end of the post);
Now there is a problem with this method. It isn't very smooth. You see the charts moving but not smooth and rather glitchy. They make small/medium/big jumps depending of course how fast you are changing the position of the scrollbar.
This problem is even more in my application. Because this is being used in a simulation... so I'm already using my CPU a lot.
Now there are maybe two solutions to this problem.
- Create a xcontrol.
My question; Will it help to create a xcontrol? Will it be more efficient/smoother then my current method?
- Use the mixed signal graph.
The problem in here is, is that it is a graph and not a chart. I need a chart because the chart of the buffering of the data. I tried this solution by creating my own buffer VI which buffers the data. However I believe my VI isn't very efficient, yet it is a very simple one. Can be downloaded at the end of the post.
+ Now can anybody give me an indication of my question about the xcontrol? This is because I never made a xcontrol so it will be new to me, but I don't want to put a lot of work in it when it won't help anyway.
+ Has anyone a better way of buffering data then I'm doing now? So I can use the mixed signal graph as a "mixed signal chart".
+ Maybe someone has a better solution then the possible solutions I thought of?
07-19-2010 09:30 AM
Are you sure you posted the right VI? The front panel of the VI you posted does not look like what you show in your picture. Also, I don't see the Buffer VI being used anywhere. When I ran your VI I'm not seeing the stuttering that you're saying you see. Perhaps it's because there's no data in the graphs.
Is there a specific reason you're using variant as the datatype? Converting to/from variant can be an expensive operation.
Note that in general, overlapping controls can create huge slowdowns in redrawing time. In your case the scrollbar overlaps the graphs, though I'm not really sure how much of an impact that would really cause.
07-19-2010 10:46 AM - edited 07-19-2010 10:52 AM
Yes it's the right VI, I just removed the chart range control from the example after I took the screenshot 😉 and it's proberbly fast now because as you state yourself there is no data in it and no other operations are being done.
And I didn't made a example of the Buffer VI because I thought it was pretty straight forward. The reason I made it a variant is because so I could re-use the VI for other uses and other datatypes. But I will try if it improves by using the datatype I'm currently using for the graph.
And I will try to examine if it really does matter if some controls are over the chart...
07-19-2010
11:11 AM
- last edited on
10-09-2024
05:26 PM
by
Content Cleaner
A couple of quick comments (please post a VI that generates and graphs actual data).
The value change event on the scrollbar should not be set to lock the front panel. You should also use a case structure to skip stale events. (Have a look at this example and, if you like my related idea, please vote for it. :))
Your buffer tool is extremely inefficient, not just because of the datatype, because once the size is reached, the array is resized twice with every iteration, causing memory allocation overhead. You should use a fixed size array and operate in place (e.g. rotate..replace element or similar). If you would use DBL, You can fill it with NaN. If you want to support multiple datatypes, create a polymorphic VI instead.
(Also, we already have a similar buffer tool. Have a look at the guts inside the collector express VI for some coding ideas).
07-19-2010
01:10 PM
- last edited on
10-09-2024
05:26 PM
by
Content Cleaner
"The value change event on the scrollbar should not be set to lock the front panel."
Thanks for the tip your right that it shouldn't, but just a question does this also affect the execution speed?
"You should also use a case structure to skip stale events. (Have a look at this example and, if you like my related idea, please vote for it. )"
This was really brilliant I didn't know that this occured. I voted for your idea 😉 it is already a lot beter now.
"(Also, we already have a similar buffer tool. Have a look at the guts inside the collector express VI for some coding ideas)."
And thanks for this tip. I never really look at the express VI's but this one can be handy.
I will post a example tomorrow. I'm pretty tired now in fact.
Furthermore since none of you replied that question, I guess it will not make any difference if I would create a xcontrol?
ps. I didn't say this in my startpost but using a "Splitter bar" isn't a option for me either.
07-19-2010 01:23 PM
@WouterG wrote:
Furthermore since none of you replied that question, I guess it will not make any difference if I would create a xcontrol?
An Xcontrol would certainly be another option. I don't know how easy it would be and what performance bottlenecks could arise. Have you tried?
07-19-2010 01:44 PM
No I didn't tried yet because I don't have any experience with Xcontrols, thats why I asked if anyone could give a indication of how much better the performance would get 😉
But I think I will just try creating one tomorrow, this is a good excuse to try 😛