我正在查看的命名空间System.Windows.Forms.DataVisualization.Charting
位于 .NET Framework 3.5 中。
我已经构建了一个Chart
带有名称的名称并向该图表chart1
添加了一个Series
调用。mySeries
在设计器中该系列的数据部分中,我有:
IsXValueIndexed --> False
Name --> mySeries
Points --> (Collection)
XValueType --> DateTime
YValuesPerPoint --> 1
YValueType --> Int32
当我尝试DataPoint
像这样将 s 添加到系列时,似乎我无法使用适当类型的 x 和 y 值添加它们:
public void InitializeChart()
{
Series theSeries = chart1.Series["mySeries"];
// MyData is of type List<MyDatum> and MyDatum has two members --
// one of type DateTime and another of type int
foreach (MyDatum datum in MyData)
{
// I'd like to construct a DataPoint with the appropriate types,
// but the compiler wants me to supply doubles to dp
DataPoint dp = new DataPoint(mySeries);
dp.XValue = datum.TimeStamp;
dp.YValue = datum.MyInteger;
radiosConnectedSeries.Points.Add(dp);
}
}
我错过了什么?一如既往的感谢!