LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create circular shape of 2D array

I have 2D array that contains 5 elements. I want to display it in the "circular" shape, so that one of the elements is in center and others are in the shape of the circle. I want to be able to resize array to lets say 7 elements. 

 

For example I have 2D array with the last element empty:

1 2 3

4 5 -

 

I want to display this array on the front panel in circular shape:

 

1       2

    3

4       5

 

OR.

 

1       2

    5

3       4

 

 

0 Kudos
Message 1 of 9
(3,178 Views)

First, You cannot have "Ragged Arrays" in LabVIEW without doing some strange things

 

Your description of what you want displayed is unclear


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 9
(3,152 Views)

Hi Andraz,

 


@AndrazS wrote:

I have 2D array that contains 5 elements. I want to display it in the "circular" shape, so that one of the elements is in center and others are in the shape of the circle.


Convert that array into a cluster. In the cluster you can place the elements at your wish in the frontpanel. You can even make the cluster border/background transparent so nobody will even see you are using a cluster…

 


@AndrazS wrote:

I want to be able to resize array to lets say 7 elements. 


This will get more tricky as you cannot resize clusters at runtime: you need to know in advance how many elements you want to display…

(You might use a cluster with 7 elements from the start, but hide two elements when you only want to display 5 elements. In a cluster you can easily change the properties of each cluster element while in an array all elements share the same properties!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(3,145 Views)

Here is an implementation example using GerdW's idea:

Example_VI.png


GCentral
0 Kudos
Message 4 of 9
(3,105 Views)

This thread should be marked as a milestone moment.  I have a feeling that no one has ever asked for such a thing before in the history of programming.

Message 5 of 9
(3,093 Views)

If you need this to be flexible and you want them in some custom shape, that is going to take some time. Is there going to be some limit to the size of the incoming 2D array? Is the shape in some predetermined shape or order? If you know you are never going to have more than say ten in your array you could place indicators off of the screen and move them where you want them to be based on the array size. You could do the same thing inside of a cluster if that would be easier you you to manage. For the case of the cluster you could make the cluster and not have it resize. Move the indicators so they are not obvious. Then move them around inside of the cluster to put them where you want them.

 

One other way I can think of doing this would be to place a tab control on the front panel and have different instances of the display for the different array sizes. Change the tab to the correct size and display the results. 

 

I have a feeling that this is going to be tougher than you are hoping for.

Tim
GHSP
0 Kudos
Message 6 of 9
(3,081 Views)

<iframe class="embeddedObject shadow resizable" name="embedded_content" scrolling="no" frameborder="0" type="text/html"
style="overflow:hidden;" src="https://www.screencast.com/users/JayThornby/folders/Jing/media/130bf934-c0b5-43cc-9e83-c0f7d05bfa7b/..." height="574" width="866" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

 

Why not

 

Capture1.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 9
(3,074 Views)

Will circular gauge with text labels work?

circle array.png

0 Kudos
Message 8 of 9
(3,045 Views)

It can be done using a picture control.

 

One value inserted at the center and the others arranged around the edges of a circle.

 

It gets a little trickier (but can be done) if the user has to change the values. That can be handled by tracking the location of each displayed value and detecting mouse down on the picture to figure out which number was clicked.

 

Then...

 

Move an off-screen hidden control to the right place, init it with the value that was displayed and let the user poke at the number. Mouse exit grabs the new value, updates the picture and then hides the previously hidden control. 

 

This thread has links to examples using the Picture.

 

 This thread has an example of arbitrary image placement and click detection as shown below.

 

Picture_Interface.PNG

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 9
(3,022 Views)