SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Using MVVM I am trying to force my 2nd Y axis to a specific min and max value. I’m setting the AutoRange to never and the VisibleRange to a DoubleRange(min, max) in my ViewModel in a function named ‘SetAxes(min, max)’.
The behavior seems to be that it works the first time I add a measurement to my chart. On subsequent updates to the chart (when I tell the chart via a method in my model to change it’s axes) it doesn’t update. Here is what I have…
public void SetAxes(double min, double max)
{
RightAxisAutoRange = AutoRange.Never;
RightAxisVisibleRange = new DoubleRange(min, max);
}
// 2nd axis range
private IRange _rightAxisVisibleRange;
private AutoRange _rightAxisAutoRange;
public IRange RightAxisVisibleRange
{
get { return _rightAxisVisibleRange; }
set { SetProperty(ref _rightAxisVisibleRange, value); }
}
public AutoRange RightAxisAutoRange
{
get { return _rightAxisAutoRange; }
set { SetProperty(ref _rightAxisAutoRange, value); }
}
<!-- 2nd Y Axis -->
<s:NumericAxis AxisTitle="{Binding Path=RightAxisTitle}"
Id="YAxis2"
AxisAlignment="Right"
Visibility="{Binding Path=RightAxisVisibility}"
FontFamily="Arial"
VisibleRange="{Binding Path=RightAxisVisibleRange}"
AutoRange="{Binding Path=RightAxisAutoRange}"
GrowBy="0.1, 0.1"
Style="{DynamicResource ResourceKey=RatioAxisStyle}"
s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />
Don’t get hung up on the “SetProperty” function in my setters. That’s just an internal mechanism I use in a base class which implements INotifyPropertyChanged.
What I’ve noticed is that the moment I decide to zoom the right Y axis refuses to ever go back to it’s original range. I suppose a way to turn off 2nd Y axis zooming would resolve my problem?
Please login first to submit.