Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically change Graph axis range C#

Solved!
Go to solution

I got mine to work but  just wanted to make sure I am doing it properly.  I'm only asking because I had to use casting and hardcoded element retrieval.

This is what works for me:

 

AxisDouble Yaxis = (AxisDouble)Graph.Axes.ElementAt(0);
Yaxis.Range = new Range<double>(-25000, 25000);

 

I also set Adjuster="None" in XAML.

 

Thank you.

0 Kudos
Message 1 of 3
(5,102 Views)
Solution
Accepted by topic author kirko7

Your approach is fine. Since you are declaring the axis in XAML, you could also use a name instead of referring to it by index location:

 

    <ni:AxisDouble x:Name="Yaxis" Adjuster="None" ... />

~ Paul H
0 Kudos
Message 2 of 3
(5,097 Views)

Much better.  Didn't think of that... 

Thank you

0 Kudos
Message 3 of 3
(5,094 Views)