我在使用 Winform 图表控件创建折线图时遇到错误。 (我用的是VS2013)
I'm plotting a line chart and it produces the strange visual effect of a single solid line connecting the first and last points in addition to the correct points.
![enter image description here](https://i.stack.imgur.com/81rPz.jpg)
I don't want the straight line. When I plot this in Excel, I get the correct graph so I know the data series is good.
![enter image description here](https://i.stack.imgur.com/RNUHE.jpg)
我已经修改了许多系列设置,但无法让直线消失。这可以解决吗?
我生成该系列的代码如下。感谢您的帮助。
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
foreach (var series in chart1.Series)
{
series.Points.Clear();
}
string chartValues = "SELECT statDay, itemCount, [60DayMAVG] FROM tbl_MAVG_dev WHERE streamID = " + numericUpDown1.Value;
SqlConnection getStreamData = new SqlConnection("Data Source=SQLSERVER;Initial Catalog=MyOwnSQLBox;Integrated Security=True");
SqlCommand getValuesCMD = new SqlCommand(chartValues, getStreamData);
try
{
getStreamData.Open();
SqlDataReader getValuesReader = getValuesCMD.ExecuteReader();
while (getValuesReader.Read())
{
//chart1.Series["itemCount"].Points.AddXY(Convert.ToDateTime(getValuesReader.GetDateTime(0)), Convert.ToInt32(getValuesReader.GetInt64(1)));
chart1.Series["mavg"].Points.AddXY(Convert.ToDateTime(getValuesReader.GetDateTime(0)), Convert.ToInt32(getValuesReader.GetDouble(2)));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
您的终点之一的订单已过时和/或您的终点之一有重复项。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)