Check this code with a button click.
private void button1_Click(object sender, EventArgs e)
{
chart1.Series.ElementAt(0).LegendText = "Something";
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "MM-dd HH" + "extra";
chart1.Series[0].XValueType = ChartValueType.DateTime;
chart1.Series.ElementAt(0).ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
List<datapoint> Data = new List<datapoint>();
Data.Add(new DataPoint(1, 10));
Data.Add(new DataPoint(2, 20));
Data.Add(new DataPoint(3, 30));
chart1.Series.ElementAt(0).ChartType = SeriesChartType.Column;
foreach (var item in Data)
{
//DataPoint dp = new DataPoint();
//dp.SetValueXY(item.Key, item.Value);
chart1.Series.ElementAt(0).Points.Add(item);
chart1.Series.ElementAt(0).MarkerColor = Color.Red;
chart1.Series.ElementAt(0).ShadowColor = Color.Green;
chart1.Series.ElementAt(0).LabelBackColor = Color.Green;
}
LineAnnotation a = new LineAnnotation();
a.Name = "lineAnnotation";
a.ToolTip = "checking";
a.X = 1;
a.Y = 10;
a.Visible = true;
chart1.Annotations.Add(a);
//放批注
chart1.Annotations[0].AnchorDataPoint = chart1.Series[0].Points[1];
}