0

What chart type do I need for a wave line like the sinus / cosinus? I'm using the default chart in windows forms.

chart1.Series[0].ChartType = SeriesChartType.Line;

Is this the right chart type for this?

Also how do I display radians on the X line...

chart1.ChartAreas[0].AxisX.Minimum = 0 * Math.PI;
chart1.ChartAreas[0].AxisX.Maximum = 2 * Math.PI;
4

1 回答 1

1

这是一个对我有用的例子:

var data = new List<Tuple<double,double>>();
for (double x = 0; x < Math.PI * 2; x += Math.PI / 180.0) {
    data.Add(Tuple.Create(x, Math.Sin(x)));
}
chart1.ChartAreas.Add("area1");
var series = chart1.Series.Add("series1");
series.ChartType = SeriesChartType.Line;
series.ChartArea = "area1";
series.XValueMember = "Item1";
series.YValueMembers = "Item2";
chart1.DataSource = data;

结果:

带图表的表格

于 2013-08-06T22:11:57.447 回答