
Is it possible to bind to an Axis?
This discussion was imported from CodePlex
_Noctis_ wrote at 2013-11-05 14:29:
From the Axes documentation:
more to the point, the reason was I wanted to see if I can make two charts share an axis, so moving one will move the other ...
Ideas? Suggestions?
Adding axes in XAML
<oxy:Plot Title="Linear axes">
<oxy:Plot.Axes>
<oxy:LinearAxis Position="Bottom" Minimum="-20" Maximum="80" />
<oxy:LinearAxis Position="Left" Minimum="-10" Maximum="10" />
</oxy:Plot.Axes>
</oxy:Plot>
Adding axes to a PlotModel
var model=new PlotModel();
model.Axes.Add(new LinearAxis(AxisPosition.Bottom,-20,80));
model.Axes.Add(new LinearAxis(AxisPosition.Left,-10,10));
But, what if I want to bind from the XAML to an axis ?! more to the point, the reason was I wanted to see if I can make two charts share an axis, so moving one will move the other ...
Ideas? Suggestions?
objo wrote at 2013-11-06 23:13:
To do this with binding, we need to add
https://oxyplot.codeplex.com/workitem/10096
In the current implementation, you can subscribe to the AxisChanged event on the axis (not yet available on the Wpf.Axis class), read the ActualMinimum and ActualMaximum and use the Zoom(x0,x1) method to set the range on the other axis.
The AxisChanged routed event is registered at
https://oxyplot.codeplex.com/workitem/9992
Also remember to invalidate the plot every time the values are changed.
ActualMinimum
and
ActualMaximum
dependency properties (one-way). https://oxyplot.codeplex.com/workitem/10096
In the current implementation, you can subscribe to the AxisChanged event on the axis (not yet available on the Wpf.Axis class), read the ActualMinimum and ActualMaximum and use the Zoom(x0,x1) method to set the range on the other axis.
The AxisChanged routed event is registered at
https://oxyplot.codeplex.com/workitem/9992
Also remember to invalidate the plot every time the values are changed.
Служба підтримки клієнтів працює на UserEcho