我对wpf和oxyPlot很陌生。现在,我想要创建一个像示波器一样的动态线条图,但是我不知道当鼠标轮缩放时如何锁定轴的值。
示例:

红色点是鼠标位置。在正常情况下,变焦A -> B,变焦C -> D。现在,我想放大C ->E,就像鼠标在0中心的位置。
发布于 2017-01-11 11:08:16
我找到了一个解决方案,可以阻止一个轴变焦中心。您必须创建一个自定义LinearAxis来实现这一点:
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);
}
}你必须这样使用它:
var bottomAxis = new FixedCenterLinearAxis(0.5) //specify the center value here
{
Position = AxisPosition.Bottom,
};
plotModel.Axes.Add(bottomAxis);如果没有在构造函数上指定值,则中心值将为0。
https://stackoverflow.com/questions/41565360
复制相似问题