tags:

views:

27

answers:

2

I want to graph some data with Date vs Value.
The problem is that I don't know how to make a PointPairList accept DateTime values and Double values.

+1  A: 

What version of the framework are you using. If it's .NET 4 you can use a Tuple:

var dataPoints = new List<Tuple<DateTime, double>>();

If you are using an earlier framework version, you can instead create a simple class to hold the data points:

public class DataPoint
{
    public DateTime DateTime { get; set; }
    public double Value { get; set; }
}

...and use that instead:

var dataPoints = new List<DataPoint>();
Fredrik Mörk
Or use the `KeyValuePair<DateTime, double>` in `System.Collections`
Patrick
A: 

ZedGraph has its own Date format: XDate
You can easily convert DateTime to XDate.

More info:
http://zedgraph.org/wiki/index.php?title=What_is_an_XDate_struct%3F
Example:
http://zedgraph.org/wiki/index.php?title=Tutorial:Date_Axis_Chart_Demo

Gacek