2013-05-12 51 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