X轴类型是DateTime
。我想知道如何从与我系列中的点对应的x轴上的double值中提取原始DateTime
值?
我可以加点
point->SetValueXY(xdateTime,yvalue);
chart1->Series[0]-Add(point);
试试这个C#代码,它应该给你一个开始。我用它来向Label
添加文本,它将x值显示为日期,将y值显示为数字。希望这可以帮助
public void Cht_Click(object sender, System.Windows.Forms.MouseEventArgs e)
{
//Call HitTest()
HitTestResult result = sender.HitTest(e.X, e.Y);
//If the mouse if over a data point
if (result.ChartElementType == ChartElementType.DataPoint) {
//Reset Data Point Attributes
DataPoint point = default(DataPoint);
//Find selected data point
point = result.Series.Points(result.PointIndex);
//extract x value
System.DateTime _date = System.DateTime.FromOADate(point.XValue);
Label24.Text = "Date: " + Strings.Format(_date, "dd/MM/yy") + " Value: " + point.YValues(0);
}
}