2013-05-12 53 views
0

我無法將zedgraph拆分爲多個部分,我希望能夠監控我的運行會話,並且認爲我會嘗試構建一個顯示我的結果的程序,主要是在圖表上加快速度。結果從文本文件中讀取,然後將其存儲在當前的zedgraph的int列表和pointparlist中。我希望能夠將圖形分成三部分,前15%是熱身部分,中間(70%)是主要跑步部分,最後是冷卻部分(15%)。 。而不是在圖表上繪製整個會話,並手動設法找出我的熱身活動結束的位置,我想知道是否可以在熱身和中間之後放置垂直線。如何用一條垂直線將三個部分分割成一個zed-graph來分隔它們?

我非常感謝任何建議或對此的幫助,我一直在嘗試幾天,但我無法設法把我的意圖放在谷歌搜索,如果這是有道理的。

在將圖表繪製到圖表上之前,將分割存儲速度值的int列表是否更好?我很樂意就如何解決這個問題提供建議。再次感謝很多傢伙。

回答

1

簡單的方法是繪製兩條垂直線,然後它變成3個部分。下面的代碼:

PointPairList warmUpList = new PointPairList(); 
    LineItem warmUpCurve = new LineItem("warmUpCurve"); 
    PointPairList coolingDownList = new PointPairList(); 
    LineItem coolingDownCurve = new LineItem("coolingDownCurve"); 

    private void Form1_Load(object sender, EventArgs e) 
    { 
     // Create an instance of Graph Pane 
     GraphPane myPane = zedGraphControl1.GraphPane; 

     // x & y variables to store the axis values 
     double xVal; 
     double yVal; 

     // Clear the previous values if any 
     warmUpList.Clear(); 
     coolingDownList.Clear(); 

     myPane.Legend.IsVisible = false; 

     // Create a list using the above x & y values 
     warmUpList.Add(myPane.XAxis.Scale.Min + myPane.XAxis.Scale.MajorStep*1.5 , myPane.YAxis.Scale.Max); 
     warmUpList.Add(myPane.XAxis.Scale.Min + myPane.XAxis.Scale.MajorStep * 1.5, myPane.YAxis.Scale.Min); 

     coolingDownList.Add(myPane.XAxis.Scale.Max - myPane.XAxis.Scale.MajorStep * 1.5, myPane.YAxis.Scale.Max); 
     coolingDownList.Add(myPane.XAxis.Scale.Max - myPane.XAxis.Scale.MajorStep * 1.5, myPane.YAxis.Scale.Min); 

     // Add the curves 
     warmUpCurve = myPane.AddCurve(" ", warmUpList, Color.Red, SymbolType.None); 
     coolingDownCurve = myPane.AddCurve(" ", coolingDownList, Color.Red, SymbolType.None); 

     TextObj WarmUpTextObj = new TextObj("Warm Up", myPane.XAxis.Scale.Min + myPane.XAxis.Scale.MajorStep, myPane.YAxis.Scale.Max - myPane.YAxis.Scale.MajorStep); 
     TextObj RunningTextObj = new TextObj("Running Test", myPane.XAxis.Scale.Max/2, myPane.YAxis.Scale.Max - myPane.YAxis.Scale.MajorStep); 
     TextObj CoolingDownTextObj = new TextObj("Cooling Down", myPane.XAxis.Scale.Max - myPane.XAxis.Scale.MajorStep, myPane.YAxis.Scale.Max - myPane.YAxis.Scale.MajorStep); 

     myPane.GraphObjList.Add(WarmUpTextObj); 
     myPane.GraphObjList.Add(RunningTextObj); 
     myPane.GraphObjList.Add(CoolingDownTextObj); 

     zedGraphControl1.Refresh(); 
    } 

enter image description here