public float Caculate() { CpkPro cpkpro = new CpkPro(); string[] ret = SaveStatic.ReadTxt(_path); float[] retf = new float[ret.Length]; for (int i = 0; i < ret.Length; i++) { retf[i] = Convert.ToSingle(ret[i]); } return(cpkpro.GetCPK(retf, _upper, _lower)); }
public void InitChartset() { if (File.Exists(Application.StartupPath + "\\chartset.txt")) { FileSystemWatcher fsw = new FileSystemWatcher(Path.GetDirectoryName(Application.StartupPath + "\\chartset.txt"), "*.txt"); fsw.EnableRaisingEvents = true; fsw.NotifyFilter = NotifyFilters.LastWrite; fsw.Changed += new FileSystemEventHandler(fsw_Changed); } else { SaveStatic.SaveTxt(Application.StartupPath + "\\chartset.txt", "", false); FileSystemWatcher fsw = new FileSystemWatcher(Path.GetDirectoryName(Application.StartupPath + "\\chartset.txt"), "*.txt"); fsw.EnableRaisingEvents = true; fsw.NotifyFilter = NotifyFilters.LastWrite; fsw.Changed += new FileSystemEventHandler(fsw_Changed); } Flag = true; }
private void setchart_FormClosing(object sender, FormClosingEventArgs e) { DialogResult ret = MessageBox.Show("保存并更新信息?", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 0); if (ret != DialogResult.OK) { return; } string[][] info = new string[11][]; for (int i = 0; i < 11; i++) { info[i] = new string[2] { "", "" }; info[i][0] = ck[i].Checked.ToString(); info[i][1] = bt[i].BackColor.ToArgb().ToString(); } SaveStatic.SaveTxt(Application.StartupPath + "\\chartset.txt", info, false); }
private void button1_Click_1(object sender, EventArgs e) { ck = new CheckBox[11]; cd = new ColorDialog(); bt = new Button[11]; setchart = new Form(); //setchart.Name = "uu"; setchart.FormClosing += new FormClosingEventHandler(setchart_FormClosing); tp = new TableLayoutPanel(); setchart.Text = "图表设置"; tp.Dock = DockStyle.Fill; string[][] aa = SaveStatic.ReadMultiTxt(Application.StartupPath + "\\chartset.txt"); for (int i = 0; i < 11; i++) { //tp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); bt[i] = new Button(); ck[i] = new CheckBox(); ck[i].Checked = Convert.ToBoolean(aa[i][0]); ck[i].Text = lineName[i]; bt[i].BackColor = Color.FromArgb(int.Parse(aa[i][1])); bt[i].Size = ck[i].Size; bt[i].Tag = i; bt[i].Click += new EventHandler(button_click); tp.Controls.Add(ck[i], 0, i); tp.Controls.Add(bt[i], 1, i); } setchart.Height = 380; setchart.Width = 250; setchart.Controls.Add(tp); //txtChangeFlag = true; setchart.TopMost = true; setchart.FormBorderStyle = FormBorderStyle.FixedToolWindow; setchart.StartPosition = FormStartPosition.CenterScreen; setchart.ShowDialog(); }
private string readVar() { string ret = SaveStatic.ReadIni("F:\\vardata.ini", "Variables", Name); return(ret); }
private void saveVar() { SaveStatic.SaveIni("F:\\vardata.ini", "Variables", Name, valueObj.ToString() + "|" + valueObj.GetType().Name); }
public void fresh() { if (Flag) { Flag = false; flowLayoutPanel1.Controls.Clear(); if (File.Exists(Application.StartupPath + "\\chartset.txt")) { string[][] aa = SaveStatic.ReadMultiTxt(Application.StartupPath + "\\chartset.txt"); visible[0] = Convert.ToBoolean(aa[0][0]); visible[1] = Convert.ToBoolean(aa[1][0]); visible[2] = Convert.ToBoolean(aa[2][0]); visible[3] = Convert.ToBoolean(aa[3][0]); visible[4] = Convert.ToBoolean(aa[4][0]); visible[5] = Convert.ToBoolean(aa[5][0]); visible[6] = Convert.ToBoolean(aa[6][0]); visible[7] = Convert.ToBoolean(aa[7][0]); DownLineShow = Convert.ToBoolean(aa[8][0]); UpLineShow = Convert.ToBoolean(aa[9][0]); MidLineShow = Convert.ToBoolean(aa[10][0]); c_color1 = Color.FromArgb(int.Parse(aa[0][1])); c_color2 = Color.FromArgb(int.Parse(aa[1][1])); c_color3 = Color.FromArgb(int.Parse(aa[2][1])); c_color4 = Color.FromArgb(int.Parse(aa[3][1])); c_color5 = Color.FromArgb(int.Parse(aa[4][1])); c_color6 = Color.FromArgb(int.Parse(aa[5][1])); c_color7 = Color.FromArgb(int.Parse(aa[6][1])); c_color8 = Color.FromArgb(int.Parse(aa[7][1])); C_colorLow = Color.FromArgb(int.Parse(aa[8][1])); C_colorHigh = Color.FromArgb(int.Parse(aa[9][1])); C_colorMid = Color.FromArgb(int.Parse(aa[10][1])); } else { MessageBox.Show("文件chartset.txt丢失!"); return; } if (visible[0]) { chart1.Series["Series1"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color1; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[0]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series1"].Enabled = false; } if (visible[1]) { chart1.Series["Series2"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color2; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[1]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series2"].Enabled = false; } if (visible[2]) { chart1.Series["Series3"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color3; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[2]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series3"].Enabled = false; } if (visible[3]) { chart1.Series["Series4"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color4; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[3]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series4"].Enabled = false; } if (visible[4]) { chart1.Series["Series5"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color5; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[4]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series5"].Enabled = false; } if (visible[5]) { chart1.Series["Series6"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color6; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[5]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series6"].Enabled = false; } if (visible[6]) { chart1.Series["Series7"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color7; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[6]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series7"].Enabled = false; } if (visible[7]) { chart1.Series["Series8"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color8; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[7]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series8"].Enabled = false; } } if (listdatabinPath[0] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[0]) == null) { return; } string[][] _d0 = SaveStatic.ReadMultiTxt(listdatabinPath[0]); string[][] d0 = Conver.TransPosition(_d0); listX[0] = Array.ConvertAll(d0[0].ToArray(), Convert.ToSingle).ToList(); listY[0] = Array.ConvertAll(d0[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series1"].Points.DataBindXY(listX[0], listY[0]); chart1.Series["Series1"].Color = c_color1; } if (listdatabinPath[1] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[1]) == null) { return; } string[][] _d1 = SaveStatic.ReadMultiTxt(listdatabinPath[1]); string[][] d1 = Conver.TransPosition(_d1); listX[1] = Array.ConvertAll(d1[0].ToArray(), Convert.ToSingle).ToList(); listY[1] = Array.ConvertAll(d1[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series2"].Points.DataBindXY(listX[1], listY[1]); chart1.Series["Series2"].Color = c_color2; } if (listdatabinPath[2] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[2]) == null) { return; } string[][] _d2 = SaveStatic.ReadMultiTxt(listdatabinPath[2]); string[][] d2 = Conver.TransPosition(_d2); listX[2] = Array.ConvertAll(d2[0].ToArray(), Convert.ToSingle).ToList(); listY[2] = Array.ConvertAll(d2[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series3"].Points.DataBindXY(listX[2], listY[2]); chart1.Series["Series3"].Color = c_color3; } if (listdatabinPath[3] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[3]) == null) { return; } string[][] _d3 = SaveStatic.ReadMultiTxt(listdatabinPath[3]); string[][] d3 = Conver.TransPosition(_d3); listX[3] = Array.ConvertAll(d3[0].ToArray(), Convert.ToSingle).ToList(); listY[3] = Array.ConvertAll(d3[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series4"].Points.DataBindXY(listX[3], listY[3]); chart1.Series["Series4"].Color = c_color4; } if (listdatabinPath[4] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[4]) == null) { return; } string[][] _d4 = SaveStatic.ReadMultiTxt(listdatabinPath[4]); string[][] d4 = Conver.TransPosition(_d4); listX[4] = Array.ConvertAll(d4[0].ToArray(), Convert.ToSingle).ToList(); listY[4] = Array.ConvertAll(d4[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series5"].Points.DataBindXY(listX[4], listY[4]); chart1.Series["Series5"].Color = c_color5; } if (listdatabinPath[5] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[5]) == null) { return; } string[][] _d5 = SaveStatic.ReadMultiTxt(listdatabinPath[5]); string[][] d5 = Conver.TransPosition(_d5); listX[5] = Array.ConvertAll(d5[0].ToArray(), Convert.ToSingle).ToList(); listY[5] = Array.ConvertAll(d5[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series6"].Points.DataBindXY(listX[5], listY[5]); chart1.Series["Series6"].Color = c_color6; } if (listdatabinPath[6] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[6]) == null) { return; } string[][] _d6 = SaveStatic.ReadMultiTxt(listdatabinPath[6]); string[][] d6 = Conver.TransPosition(_d6); listX[6] = Array.ConvertAll(d6[0].ToArray(), Convert.ToSingle).ToList(); listY[6] = Array.ConvertAll(d6[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series7"].Points.DataBindXY(listX[6], listY[6]); chart1.Series["Series7"].Color = c_color7; } if (listdatabinPath[7] != "") { if (SaveStatic.ReadMultiTxt(listdatabinPath[7]) == null) { return; } string[][] _d7 = SaveStatic.ReadMultiTxt(listdatabinPath[7]); string[][] d7 = Conver.TransPosition(_d7); listX[7] = Array.ConvertAll(d7[0].ToArray(), Convert.ToSingle).ToList(); listY[7] = Array.ConvertAll(d7[1].ToArray(), Convert.ToSingle).ToList(); chart1.Series["Series8"].Points.DataBindXY(listX[7], listY[7]); chart1.Series["Series8"].Color = c_color8; } float[] Xc = new float[8]; for (int i = 0; i < 8; i++) { if (listX[i] != null) { if (listX[i].Count > 0) { Xc[i] = listX[i][listX[i].Count - 1]; } } } X = Xc.Max(); //X = listX[0].Count - 1; if (follow == true) { if (X > showCount) { if (X > chartCount) { chart1.ChartAreas[0].AxisX.Minimum = X - chartCount; } chart1.ChartAreas[0].AxisX.Maximum = X; chart1.ChartAreas[0].AxisX.ScaleView.Zoom(X - showCount + 1, X); } else { chart1.ChartAreas[0].AxisX.Minimum = 0; chart1.ChartAreas[0].AxisX.Maximum = showCount; ZoomReset(); //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, totalCount-1); } } else { if (X <= showCount) { chart1.ChartAreas[0].AxisX.Maximum = showCount; ZoomReset(); //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, 50); } else { chart1.ChartAreas[0].AxisX.Maximum = X; } } }
public void fresh() { if (Flag) { Flag = false; flowLayoutPanel1.Controls.Clear(); if (File.Exists(filePath)) { try { string[][] aa = ReadMultiTxtC(filePath); visible[0] = Convert.ToBoolean(aa[0][0]); visible[1] = Convert.ToBoolean(aa[1][0]); visible[2] = Convert.ToBoolean(aa[2][0]); visible[3] = Convert.ToBoolean(aa[3][0]); visible[4] = Convert.ToBoolean(aa[4][0]); visible[5] = Convert.ToBoolean(aa[5][0]); visible[6] = Convert.ToBoolean(aa[6][0]); visible[7] = Convert.ToBoolean(aa[7][0]); DownLineShow = Convert.ToBoolean(aa[8][0]); UpLineShow = Convert.ToBoolean(aa[9][0]); MidLineShow = Convert.ToBoolean(aa[10][0]); c_color1 = Color.FromArgb(int.Parse(aa[0][1])); c_color2 = Color.FromArgb(int.Parse(aa[1][1])); c_color3 = Color.FromArgb(int.Parse(aa[2][1])); c_color4 = Color.FromArgb(int.Parse(aa[3][1])); c_color5 = Color.FromArgb(int.Parse(aa[4][1])); c_color6 = Color.FromArgb(int.Parse(aa[5][1])); c_color7 = Color.FromArgb(int.Parse(aa[6][1])); c_color8 = Color.FromArgb(int.Parse(aa[7][1])); C_colorLow = Color.FromArgb(int.Parse(aa[8][1])); C_colorHigh = Color.FromArgb(int.Parse(aa[9][1])); C_colorMid = Color.FromArgb(int.Parse(aa[10][1])); } catch (Exception exp) { MessageBox.Show("读取图表配置文件失败!" + exp); } } else { MessageBox.Show("文件chartset.txt丢失!"); return; } if (visible[0]) { chart1.Series["Series1"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color1; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[0]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series1"].Enabled = false; } if (visible[1]) { chart1.Series["Series2"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color2; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[1]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series2"].Enabled = false; } if (visible[2]) { chart1.Series["Series3"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color3; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[2]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series3"].Enabled = false; } if (visible[3]) { chart1.Series["Series4"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color4; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[3]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series4"].Enabled = false; } if (visible[4]) { chart1.Series["Series5"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color5; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[4]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series5"].Enabled = false; } if (visible[5]) { chart1.Series["Series6"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color6; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[5]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series6"].Enabled = false; } if (visible[6]) { chart1.Series["Series7"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color7; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[6]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series7"].Enabled = false; } if (visible[7]) { chart1.Series["Series8"].Enabled = true; TableLayoutPanel tp = new TableLayoutPanel(); tp.AutoSize = true; Label lab1 = new Label(); lab1.AutoSize = true; lab1.Text = " "; lab1.BackColor = c_color8; Label lab2 = new Label(); lab2.AutoSize = true; lab2.Text = " "; lab2.Text = lineName[7]; tp.Controls.Add(lab1, 0, 0); tp.Controls.Add(lab2, 1, 0); flowLayoutPanel1.Controls.Add(tp); } else { chart1.Series["Series8"].Enabled = false; } } if (listdatabinPath[0] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[0]); if (_d == null) { return; } listX[0].Clear(); listY[0].Clear(); for (int i = 0; i < _d.Length; i++) { listX[0].Add(i); listY[0].Add(float.Parse(_d[i])); } chart1.Series["Series1"].Points.DataBindXY(listX[0], listY[0]); chart1.Series["Series1"].Color = c_color1; } if (listdatabinPath[1] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[1]); if (_d == null) { return; } listX[1].Clear(); listY[1].Clear(); for (int i = 0; i < _d.Length; i++) { listX[1].Add(i); listY[1].Add(float.Parse(_d[i])); } chart1.Series["Series2"].Points.DataBindXY(listX[1], listY[1]); chart1.Series["Series2"].Color = c_color2; } if (listdatabinPath[2] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[2]); if (_d == null) { return; } listX[2].Clear(); listY[2].Clear(); for (int i = 0; i < _d.Length; i++) { listX[2].Add(i); listY[2].Add(float.Parse(_d[i])); } chart1.Series["Series3"].Points.DataBindXY(listX[2], listY[2]); chart1.Series["Series3"].Color = c_color3; } if (listdatabinPath[3] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[3]); if (_d == null) { return; } listX[3].Clear(); listY[3].Clear(); for (int i = 0; i < _d.Length; i++) { listX[3].Add(i); listY[3].Add(float.Parse(_d[i])); } chart1.Series["Series4"].Points.DataBindXY(listX[3], listY[3]); chart1.Series["Series4"].Color = c_color4; } if (listdatabinPath[4] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[4]); if (_d == null) { return; } listX[4].Clear(); listY[4].Clear(); for (int i = 0; i < _d.Length; i++) { listX[4].Add(i); listY[4].Add(float.Parse(_d[i])); } chart1.Series["Series5"].Points.DataBindXY(listX[4], listY[4]); chart1.Series["Series5"].Color = c_color5; } if (listdatabinPath[5] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[5]); if (_d == null) { return; } listX[5].Clear(); listY[5].Clear(); for (int i = 0; i < _d.Length; i++) { listX[5].Add(i); listY[5].Add(float.Parse(_d[i])); } chart1.Series["Series6"].Points.DataBindXY(listX[5], listY[5]); chart1.Series["Series6"].Color = c_color6; } if (listdatabinPath[6] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[6]); if (_d == null) { return; } listX[6].Clear(); listY[6].Clear(); for (int i = 0; i < _d.Length; i++) { listX[6].Add(i); listY[6].Add(float.Parse(_d[i])); } chart1.Series["Series7"].Points.DataBindXY(listX[6], listY[6]); chart1.Series["Series7"].Color = c_color7; } if (listdatabinPath[7] != "") { string[] _d = SaveStatic.ReadTxt(listdatabinPath[7]); if (_d == null) { return; } listX[7].Clear(); listY[7].Clear(); for (int i = 0; i < _d.Length; i++) { listX[7].Add(i); listY[7].Add(float.Parse(_d[i])); } chart1.Series["Series8"].Points.DataBindXY(listX[7], listY[7]); chart1.Series["Series8"].Color = c_color8; } float[] Xc = new float[8]; for (int i = 0; i < 8; i++) { if (listX[i] != null) { if (listX[i].Count > 0) { Xc[i] = listX[i][listX[i].Count - 1]; } } } X = Xc.Max(); //X = listX[0].Count - 1; if (follow == true) { if (X > showCount) { if (X > chartCount) { chart1.ChartAreas[0].AxisX.Minimum = X - chartCount; } chart1.ChartAreas[0].AxisX.Maximum = X; chart1.ChartAreas[0].AxisX.ScaleView.Zoom(X - showCount + 1, X); } else { chart1.ChartAreas[0].AxisX.Minimum = 0; chart1.ChartAreas[0].AxisX.Maximum = showCount; ZoomReset(); //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, totalCount-1); } } else { if (X <= showCount) { chart1.ChartAreas[0].AxisX.Maximum = showCount; ZoomReset(); //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, 50); } else { chart1.ChartAreas[0].AxisX.Maximum = X; } } }