annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Draw a rectangle in a graph

Risolto!
Vai alla soluzione

Hi I would like to programmatically draw a rectangle in an XY graph (Build XY Graph.vi) . I know where the 4 points are on the graph coordinate but I still can't draw it using the Draw Rectangle block. Would you please help me how can I draw a rectangle in a graph. I ahve attached the picture to this post

0 Kudos
Messaggio 1 di 5
10.145Visualizzazioni

What have you tried? I am assuming you're using the picture functions to draw a picture and write that picture to the one of the graph's PlotImages properties? There's an example that ships with LabVIEW that shows how to draw successive circles on a graph. It's called "Graph Plot Area Images". Have you looked at that?

0 Kudos
Messaggio 2 di 5
10.142Visualizzazioni
Soluzione
Accettato da ethen99

Hiya Guys,

 

I thought this was an interesting questions - and, although I hadnt tried anything quite like this before, I thought I'd give it a whirl. 

 

Attached are 2 pieces of code. 

 

DrawRectangle on Graph.vi allows users to define the rectangle via front panel cluster.

 

Cluster defined.jpg

 

DrawRectangle on Graph (Events).vi allows the user to define the rectangle by clicking and dragging on the graph. Please note that the code requires you to start from the upper left hand corner of the rectangle, and drag to the bottom right hand corner. But, this is nothing some creative logic wouldnt solve - if you wanted the code a little more flexible.

 

User Defined.jpg

 

Please also be aware that I have not spent much time on the code, so it is not perfectly architected. But it should be food for thought!

 

Best wishes,

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
Scarica tutti
Messaggio 3 di 5
10.112Visualizzazioni

Thanks

0 Kudos
Messaggio 4 di 5
10.064Visualizzazioni

What's the purpose of the FOR loop?

0 Kudos
Messaggio 5 di 5
10.050Visualizzazioni