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.
views:
27answers:
2
+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
2010-07-26 16:18:25
Or use the `KeyValuePair<DateTime, double>` in `System.Collections`
Patrick
2010-07-26 16:26:32
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
2010-07-26 20:12:51