oxyplot axis locking center when mouse wheel

夙愿已清 提交于 2019-12-02 02:54:50

I've found a solution that works for blocking an axis zoom center. You have to create a custom LinearAxis to achieve this:

public class FixedCenterLinearAxis : LinearAxis
{
    double center = 0;
    public FixedCenterLinearAxis() : base(){}

    public FixedCenterLinearAxis(double _center) : base()
    {
        center = _center;
    }

    public override void ZoomAt(double factor, double x)
    {
        base.ZoomAt(factor, center);
    }
}

You have to use it like that:

var bottomAxis = new FixedCenterLinearAxis(0.5) //specify the center value here
{
    Position = AxisPosition.Bottom,
};

plotModel.Axes.Add(bottomAxis);

If you dont specify a value on the constructor, center value will be 0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!