Reputation: 23
I am having trouble splitting a zedgraph into sections, I want to be able to monitor my running sessions and thought I would try build a program that displays my results, mainly speed on a graph. The results are read from a text file, this is then stored currently in a int list and a pointparlist for the zedgraph. I want to be able to split the graph into three sections, the first 15% is the warm up part of the run, the middle (70%) is the main running session and finally the third is the cooling down session (15%). instead of plotting the whole session on a graph and manually trying to work out where my warm up ends ect I wanted to know if its possible to put a vertical line after the warm up and middle.
I would greatly appreciate any advice or help on this, I have been trying for a couple of days but I can not manage to put my intentions on a Google search if that makes sense.
Would it be a better approach to split the int list which stores the speed values before plotting it on the graph? I am open to advice on how to tackle this. Once again thanks a lot guys.
Upvotes: 0
Views: 805
Reputation: 2060
The simple way is to draw two vertical lines, then it becomes 3 sections. Here's the code:
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();
}
Upvotes: 1