ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

log scale small values issues

Solved!
Go to solution

I have a strange issues with plotting values in NI Measurement studio WPF graphs. The issue occurs when the axis is log based and the value on the axis spans from below 1 to above 1 (i.e. 0.001 to 1000). The graph automatically change the x-axis lower to limit to 1. The behaviour is similar to the one reported here (http://forums.ni.com/t5/Measurement-Studio-for-NET/log-scale-won-t-scale-to-show-small-values/m-p/27...) but in my case none of the value plotted is 0 or less than 0 and the axis lower limit is set higher than 0.

 

The code below will reproduce the issue:

 

Point[] pt=new Point[100];
for(int i=1; i <= 100;i++)
{
      pt[i-1] = new Point(0.1 * i, i)
}

Plot pl = new Plot("test");

pl.Data=pt;

graph.Plots.Add(pl);

 

 

Where the x-axis of graph is log10 scale (and the limits are set to {0.1, 10} in the .xaml code) and y-axis is linear (doesn't matter the scale really). The graph automatically set the x-axis to 1 and this can be changed to 0.1 but this this is reset again to 1 if the graph visible property changed.

 

This behavious does not occur if all the x-axis values are below 1 or above 1 i.e. the code below will plot correctly and the axis doesn't reset to 1 etc:

 

 

 

Point[] pt=new Point[100];
for(int i=1; i <= 100;i++)
{
      pt[i-1] = new Point(0.001 * i, i)
}

Plot pl = new Plot("test");

pl.Data=pt;

graph.Plots.Add(pl);

 

Does anyone know why this is behaving like this and what can be done to correct this?

0 Kudos
Message 1 of 4
(7,210 Views)
Solution
Accepted by topic author falopsy

What appears to be happening is that the default FitLoosely range adjuster sees values spanning from 10-1 to 101, and choose a range of 0,10 for the data. Since zero cannot be represented on a log scale, the scale coerces to an arbitrary value less than ten, giving a final range of 1,10 and cutting off the low values. I have created a task to fix this issue.

 

As a workaround, you can change the Adjuster on the scale to another value, such as FitExactly.

~ Paul H
Message 2 of 4
(7,201 Views)

Thank you very much Paul. That solves my problem (I actually set the Adjuster to None and then set the range myself in the code).

0 Kudos
Message 3 of 4
(7,190 Views)

Just wanted to let you know this issue (#443878) was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 4 of 4
(5,502 Views)