日期:2014-05-18 浏览次数:21451 次
mytype = checkedListBox1.SelectedItem.ToString();
                SeriesMethod(ref mytype);//因为是动态生成,所以我把对series相关的配置写成了方法
                _commandstr = "SELECT time, voltage FROM" + " dbo." + checkedListBox1.SelectedItem.ToString() + " ORDER BY time";
                _sqlcommand = new SqlCommand(_commandstr, _AddDase.Getcon());
                SqlDataReader sdr = _sqlcommand.ExecuteReader(CommandBehavior.CloseConnection);
                chart1.Series[checkedListBox1.SelectedItem.ToString()].Points.DataBindXY(sdr, "time", sdr, "voltage");
                chart1.ChartAreas["ChartArea1"].AxisY.Enabled = AxisEnabled.False;
                chart1.Series[checkedListBox1.SelectedItem.ToString()].YAxisType = AxisType.Secondary;
                chart1.Series[checkedListBox1.SelectedItem.ToString()].XAxisType = AxisType.Primary;
                chart1.Series[checkedListBox1.SelectedItem.ToString()].IsXValueIndexed = false;
                sdr.Close();
                _AddDase.closedatabase();