This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference | |
// http://dynamicdatadisplay.codeplex.com/discussions/281164 | |
public void setYAxisRange(int min,int max) { | |
//Y軸の固定処理 | |
ViewportAxesRangeRestriction restr = new ViewportAxesRangeRestriction(); | |
restr.YRange = new DisplayRange(min, max); | |
cp.Viewport.Restrictions.Add(restr); //ここのcpはChartPlotterクラス | |
} | |
public class DisplayRange { | |
public double Start { get; set; } | |
public double End { get; set; } | |
public DisplayRange(double start, double end) { | |
Start = start; | |
End = end; | |
} | |
} | |
public class ViewportAxesRangeRestriction : IViewportRestriction { | |
public DisplayRange XRange = null; | |
public DisplayRange YRange = null; | |
public Rect Apply(Rect oldVisible, Rect newVisible, Viewport2D viewport) { | |
if (XRange != null) { | |
newVisible.X = XRange.Start; | |
newVisible.Width = XRange.End - XRange.Start; | |
} | |
if (YRange != null) { | |
newVisible.Y = YRange.Start; | |
newVisible.Height = YRange.End - YRange.Start; | |
} | |
return newVisible; | |
} | |
public event EventHandler Changed; | |
} |