01-09-2014 08:30 AM
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?
Solved! Go to Solution.
01-09-2014
11:30 AM
- last edited on
11-20-2024
09:04 AM
by
Content Cleaner
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
.
01-09-2014 03:20 PM
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).
08-11-2015
12:49 PM
- last edited on
11-20-2024
09:04 AM
by
Content Cleaner
Just wanted to let you know this issue (#443878) was fixed in the Measurement Studio 2015 release.