From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

PlotScaledIntensity and NAN values

I often use NAN values in CVI plots and graphs (and in LabVIEW too) so that some portions of traces are not drawn, for example when my application hasn't been able to calculate some of the values.

I noticed that the behavior of PlotScaledIntensity is different, and NAN values are drawn with a color that is more or less the of of the center-scale.

 

Is this an intended behavior?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 14
(5,500 Views)

Hi Vix,

 

in order to better understand the problem, can you please tell me the scale ranges are you using when the NAN representation falls in the center-scale?

 

Thank you so much.

 

Bye

0 Kudos
Message 2 of 14
(5,484 Views)

I think it doesn't depend on the scale ranges, but anyway you can look at the attached example that shows this behavior.

Hope this helps.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 14
(5,453 Views)

Hi Vix,

 

I've got what you're saying.

Maybe the easiest way to solve the problem is to programmatically manage the NAN inputs, transforming all of those in a values that you choose...maybe one out of range value will be the better choice.

 

Hope this helps,

let me know if it works!

 

0 Kudos
Message 4 of 14
(5,448 Views)

Hi

unfortunately your suggestion is not an option:

 

int PlotScaledIntensity (int panelHandle, int controlID, void *zArray, size_t numberOfXPoints, size_t numberOfYPoints, int zDataType, double yGain, double yOffset, double xGain, double xOffset, ColorMapEntry colorMapArray[], int hiColor, size_t numberOfColors, int interpColors, int interpPixels);

 

  • values higher than the highest in the colorMapArray are translated into hiColor (that I can customize); but I use hiColor for other purposes
  • values lower than the lowest in the colorMapArray are translated into the first color in colorMapArray;

 

The mai question is: is this handling of NAN an intended behavior or not?

It's different from how NAN is handled in other graphs, so I think it's not an inteneded behavior, but rather a bug... but I'm not sure

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 5 of 14
(5,443 Views)

Hi Vix,

 

I've readed somewhere that is planned to give the possibility to choose one specific color for nan value, so that this kind of problems will be avoided in the future, but for the moment the fastest and easiest way to solve the problem is to manage nan values with a specific value chosen by you, or maybe don't let the system to consider these values when plotting the intensity chart.

 

FBM

0 Kudos
Message 6 of 14
(5,435 Views)

I've readed somewhere that is planned to give the possibility to choose one specific color for nan value

Do you refer to some feature request? Or to some internal NI document?

Could you provide more details, please?

 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 7 of 14
(5,407 Views)

...if I remember well it was a guy answering a feature request...

Sorry but I can't find it anymore...try search in the forum...I'll search too at my next free time! 🙂

 

Bye

0 Kudos
Message 8 of 14
(5,400 Views)

Hi Vix,

 

No this is not intended behavior. NAN values are not handled by the PlotScaledIntensity function. The reason it uses the middle value is because comparison operations with NAN always return 0. We use a binary search to find the corresponding color for the data value and that search thinks it is the middle color in the color map.

 

I have filed bug ID 371953 to address this issue for a future release.

 

What behavior would you expect for NAN values. You mentioned that using the Hi Color would not work for you. But in what other way would you expect the value to be handled?

National Instruments
Message 9 of 14
(5,377 Views)

Hi D

thanks for your answer.

I expect that NAN pixels are not plotted so that I can see the plot area as it is (color, grids, ....).

This is the same as PlotY function, that doesn't plot the NAN values.

 

Do you agree with my suggestion? Do you think a different behavior would be better?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 10 of 14
(5,361 Views)