Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Y Axis on graph

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?

0 Kudos
Message 1 of 5
(4,350 Views)

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.

0 Kudos
Message 2 of 5
(4,343 Views)

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.

0 Kudos
Message 3 of 5
(4,338 Views)

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.

Formats1.png

 

 

Same graph, same data, but with the above custom format class configered with scale factor of 2 makes the graph look like this.
Formats2.png

 

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

0 Kudos
Message 4 of 5
(4,335 Views)

Vijet,

 

This is perfect.

 

Thanks.

0 Kudos
Message 5 of 5
(4,324 Views)