From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot fill hides the grid.

I want to use color regions on my graph. But, if I use a background image, it doesn't adjust with the scale.

 

If I use plot fill and create data arrays for my boundaries, it hides the grid.

 

Does anyone know how to accomplish this? (see attached pictures)

 

Download All
0 Kudos
Message 1 of 6
(2,219 Views)

Here are some options, although I don't particularly like any of them. I think I would go with one, because it's the simplest:

 

  1. Use the BG image, but generate it yourself so that it matches the scale. To do this, you can call the Map Coords to XY method of the graph, which will tell you the size in pixels of each region, which can then be used to build the picture using the picture VIs. The main reason I don't like this is that it's not entirely clear when to do this (when new data comes in, when the user changes the scale, etc.) and that it depends on the data being displayed before you can get the correct values. These can probably be handled if you do this in a loop every N ms and if you defer updates before writing the data to the graph.
  2. Use the picture control VIs to build the entire graph. Then, you can simply draw the scale on top of the BG. There's a palette of VIs for drawing graphs.
  3. Use .NET controls. There's an example of using a chart library in the UI interest community.
  4. Use a 3D picture control, which I believe supports transparency. I'm not sure how easy it would be to construct all the graph pieces.

 


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(2,167 Views)

tst, I was hoping there was a simple solution.

 

I have tried redrawing the BG on every loop, otherwise, like you said, it's difficult to determine when to redraw it. The VI App. continuously falls behind in collecting the data samples, from the NI-USB 6211, and once its buffer overflows, the VI App. stops. 

 

The problem is, the VI App. is collecting samples from a NI-USB 6211 continuously. The graph displays from 3 Min. to 6 Hrs. of "Real Time" data (2 ch. @ 200Hz, updated 0.5 seconds). After six hours the older data is no longer displayed. The NI-USB 6211 is also, writing the data samples to files for viewing the data at a later time. The VI App. may run for days, once it's started.

 

Currently, in the two versions I have, the BG or the data arrays are generated once, when the VI App. is started.

 

I need a sloution, if possible, that doesn't slow down the loop time.

0 Kudos
Message 3 of 6
(2,153 Views)

Hi Jerry,

 

use separate/parallel loops for DAQ and for UI handling. That way you can handle DAQ without buffer overflows and draw your UI at reasonable (!) refresh rates...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,144 Views)

Specifically, look at producer/consumer patterns and queues.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(2,140 Views)

Highlight Sections of a Waveform Graph

https://decibel.ni.com/content/docs/DOC-22700

0 Kudos
Message 6 of 6
(2,135 Views)