2011-05-27 103 views
0

我添加ZedGraphControl並顯示到0-320範圍ZedGraphControl軸值範圍

了曲線圖,我的C#.NET項目

在此圖中的x值變爲運行時我想只顯示該區域。對於我禁用滾動,縮放也

當使用ZedGraphControl.AxisChange();它的功能顯示其他X系列也

如何只查看感興趣的領域

太感謝你了

回答

0

樣品下面的代碼應該回答你的問題。

public virtual void UpdateGraph(double[] xvals, double[] yvals, double minX, double maxX) 
    { 
     zedGraphControl1.GraphPane.XAxis.Scale.MaxAuto = false; 
     zedGraphControl1.GraphPane.XAxis.Scale.MinAuto = false; 
     zedGraphControl1.GraphPane.XAxis.Scale.Min = minX; 
     zedGraphControl1.GraphPane.XAxis.Scale.Max = maxX; 

     zedGraphControl1.GraphPane.YAxis.Scale.Min = 0; 
     zedGraphControl1.GraphPane.YAxis.Scale.Max = getMax(yvals, xvals, minX, maxX); //get y-value max within the X-value range 

     updateZedgraphControl(xvals, yvals); 

    } 

protected virtual void updateZedgraphControl(double[] xvals, double[] yvals) 
    { 
     zedGraphControl1.GraphPane.CurveList.Clear(); 
     zedGraphControl1.GraphPane.AddCurve(this.curveTitle, xvals, yvals, Color.Black, SymbolType.None); 
     this.zedGraphControl1.AxisChange(); 
     this.zedGraphControl1.Refresh(); 
    }