Is it possible to bind to an Axis?

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

_Noctis_ wrote at 2013-11-05 14:29:

From the Axes documentation:
Adding axes in XAML
<oxy:Plot Title="Linear axes">
        <oxy:LinearAxis Position="Bottom" Minimum="-20" Maximum="80" />
        <oxy:LinearAxis Position="Left" Minimum="-10" Maximum="10" />

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 ActualMinimum and ActualMaximum dependency properties (one-way).

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

Also remember to invalidate the plot every time the values are changed.