2014-03-26 2 views
0

저는 Zedgraph에 배열을 추가하고이를 폼에 표시 할 수있는 작업 프로그램이 있습니다. 이제 x 축의 표시를 점 (0..400)에서 주파수 (9e3..6e9 Hz)로 변경하고 싶습니다. 여기 내 현재 작업 기능은 다음과 같습니다Zedgraph - 포인트에서 주파수로 X 축 변경

public void AddGraph(double[] Values, string LegendName) 
{ 
    int i = 0; 
    PointPairList list = new PointPairList(); 

    for (i = 0; i < Values.Length; i++) 
    { 
     list.Add(i, Values[i]); 
    } 

    if (i > MaxXAxis) 
     MaxXAxis = i; 

    SList.Add(list); 
    SListColor.Add(Color.Black); 
    } 
    SListName.Add(LegendName); 
} 


public void ShowDiagram(string Title, string XAxisName, string YAxisName, 
         int Timeout_ms) 
    { 
     ZedGraph.ZedGraphControl zgc = new ZedGraphControl(); 
     GraphPane myPane = zgc.GraphPane; 

     LineItem myCurve = null; 

     // Set the titles and axis labels 
     myPane.Title.Text = Title; 
     myPane.XAxis.Title.Text = XAxisName; 
     myPane.YAxis.Title.Text = YAxisName; 

     for (int i = 0; i < SList.Count(); i++) 
     { 
      myCurve = myPane.AddCurve(SListName[i], SList[i], SListColor[i], 
         SymbolType.None); 
      myCurve.Line.Width = 2; 
     } 

     // Add gridlines to the plot, and make them gray 
     myPane.XAxis.MinorGrid.IsVisible = true; 
     myPane.YAxis.MinorGrid.IsVisible = true; 
     myPane.XAxis.MinorGrid.Color = Color.LightGray; 
     myPane.YAxis.MinorGrid.Color = Color.LightGray; 
     myPane.XAxis.MinorGrid.DashOff = 0; 
     myPane.YAxis.MinorGrid.DashOff = 0; 

     myPane.XAxis.MajorGrid.IsVisible = true; 
     myPane.YAxis.MajorGrid.IsVisible = true; 
     myPane.XAxis.MajorGrid.Color = Color.Gray; 
     myPane.YAxis.MajorGrid.Color = Color.Gray; 
     myPane.XAxis.MajorGrid.DashOff = 0; 
     myPane.YAxis.MajorGrid.DashOff = 0; 

     // Move Legend to bottom 
     myPane.Legend.Position = LegendPos.Bottom; 

     zgc.AxisChange(); 

     myPane.XAxis.Scale.Max = MaxXAxis; 

     zgc.Location = new Point(0, 0); 
     zgc.Size = new Size(panel_diagramm.ClientRectangle.Width, panel_diagramm.ClientRectangle.Height); 

     panel_diagramm.Controls.Add(zgc); 


    } 

어떻게 나는 그들이 x 축에 주파수를 표시 위의 두 기능을 변경할 수 ?

이미 필요한 매개 변수를 전달하고 올바른 값을 갖도록 목록을 계산하기 위해 AddGraph- 함수를 변경하려고했습니다. 하지만 그때는 ...? 해결 도움 안부

답변

0

에 대한

public void AddGraph_Frequency(int **Points**, double **StartFrequency**, 
double **StopFrequency**, double[] Values, string GraphColor, string LegendName) 

{ 
... 
double frequency = StartFrequency; //der erste Punkt 
double Intervall = (StopFrequency - StartFrequency)/Points; 
for (i = 0; i < Points; i++) 
{ 
    list.Add(frequency, Values[i]); 
    frequency = frequency + Intervall; 
} 

.... 
} 

감사합니다. 누락되었습니다 :

myPane.XAxis.Scale.Max = Stopfrequency; 
myPane.XAxis.Scale.Min = Startfrequency;