如何避免在oxyplot中的最大值后拖动?

时间:2017-01-31 09:05:58

标签: .net wpf graph oxyplot

我有一个使用oxyplot的电压日期时间图,我想要的是避免用户在最后一个点之后和沿着X轴的第一个点之前拖动。

我在x轴和y轴上有DateTimeAxis值,它显示电压值。 我这样做是为了在两个轴上添加点:

 lineSerie = new LineSeries
 {
    StrokeThickness = 2,
    MarkerSize = 3,
    CanTrackerInterpolatePoints = false,
    Smooth = false,
     LineStyle = LineStyle.Dot,
     Color = OxyColor.FromRgb(66, 134, 244)
  };
  data.ToList().ForEach(d => lineSerie.Points.Add(new DataPoint(DateTimeAxis.ToDouble(d.Time), Convert.ToDouble(d.Tesnion))));
 PlotModel.Series.Add(lineSerie); 

如何在minDate和MaxDate之后避免拖动?(假设minDate包含最左边的点,maxDate包含X轴中最右边的点)。

1 个答案:

答案 0 :(得分:1)

您可以在Axis上指定AbsoluteMinimumAbsoluteMaximum。来自source

    /// <summary>
    /// Gets or sets the absolute maximum. This is only used for the UI control. 
    /// It will not be possible to zoom/pan beyond this limit. 
    /// The default value is <c>double.MaxValue</c>.
    /// </summary>
    public double AbsoluteMaximum { get; set; }
相关问题