11-11-2011 06:28 AM
I am using a USB6211 to measure and generate voltages. The voltages are higher than the input and output range of the A/D and D/A's, so I have an attenuator on the input, and gain following the output. I want to have the Y axis on my graph show the true input voltage into the attenuator. Is there a way to to change the graph without affecting the actual data?
11-11-2011 10:40 AM
Hi there,
The default Mode on the axis is AxisMode.AutoScaleLoose.
You might want to set it to AxisMode.AutoScaleExact.
I hope this helps.
Regards,
Vijet Patankar
National Instruments.
11-11-2011 01:17 PM
I'm not sure if I understand. The voltage that I'm trying to measure is 20 volts. I divide it down to 10 volts, so that it is in the range of the A/D. I would like for the graph axis to show the trace as 20 volts, not 10 volts. Hopefully, this makes sense.
11-11-2011 02:10 PM
Hello there,
If I understand you correctly, you are looking for some kind of scaling mechanism on the axes. By scaling, i mean, even though the actual YAxis range is (0, 10), you want it to be displayed as a different range like (0, 20).
Unfortunately only XAxis on WaveformGraph, and both axes on IntensityGraph can do this. See the WaveformPlot.DefaultIncrement, IntensityPlot.DefaultXIncrement and IntensityPlot.DefaultYIncrement.
However, you can tweak the way graph displays the labels on the Axes by writing a custom FormatString.
Here is a sample code to do that.
yAxis1.MajorDivisions.LabelFormat = new MyScaledFormat(2, FormatStringMode.Numeric, "G5");
.
.
.
public class MyScaledFormat : FormatString
{
double _scaleFactor = 1;
public MyScaledFormat(double scaleFactor, FormatStringMode mode, string format)
:base(mode, format)
{
_scaleFactor = scaleFactor;
}
public override string FormatDouble(double value)
{
return base.FormatDouble(_scaleFactor * value);
}
}
By defualt my Graph with some data looks like this.
Same graph, same data, but with the above custom format class configered with scale factor of 2 makes the graph look like this.
I hope this is what you are looking for.
Let us know if this is not what you wanted to do.
Vijet Patankar
National Instruments
11-13-2011 01:05 PM
Vijet,
This is perfect.
Thanks.