public void ShowPredictCurve() { Workbook workbook = new Workbook(); workbook.LoadFromFile(@"F:/data.xlsx"); Worksheet sheetPxA = workbook.Worksheets[0]; Worksheet sheetPxB = workbook.Worksheets[1]; Worksheet sheetPxC = workbook.Worksheets[2]; Worksheet sheetPxD = workbook.Worksheets[3]; Worksheet sheetPyA = workbook.Worksheets[4]; Worksheet sheetPyB = workbook.Worksheets[5]; Worksheet sheetPyC = workbook.Worksheets[6]; Worksheet sheetPyD = workbook.Worksheets[7]; CellRange rangePxA = sheetPxA.Range[sheetPxA.FirstRow, sheetPxA.FirstColumn, sheetPxA.LastRow, sheetPxA.LastColumn]; DataTable dtPxA = sheetPxA.ExportDataTable(rangePxA, true, true); CellRange rangePxB = sheetPxB.Range[sheetPxB.FirstRow, sheetPxB.FirstColumn, sheetPxB.LastRow, sheetPxB.LastColumn]; DataTable dtPxB = sheetPxB.ExportDataTable(rangePxB, true, true); CellRange rangePxC = sheetPxC.Range[sheetPxC.FirstRow, sheetPxC.FirstColumn, sheetPxC.LastRow, sheetPxC.LastColumn]; DataTable dtPxC = sheetPxC.ExportDataTable(rangePxC, true, true); CellRange rangePxD = sheetPxD.Range[sheetPxD.FirstRow, sheetPxD.FirstColumn, sheetPxD.LastRow, sheetPxD.LastColumn]; DataTable dtPxD = sheetPxD.ExportDataTable(rangePxD, true, true); CellRange rangePyA = sheetPyA.Range[sheetPyA.FirstRow, sheetPyA.FirstColumn, sheetPyA.LastRow, sheetPyA.LastColumn]; DataTable dtPyA = sheetPyA.ExportDataTable(rangePyA, true, true); CellRange rangePyB = sheetPyB.Range[sheetPyB.FirstRow, sheetPyB.FirstColumn, sheetPyB.LastRow, sheetPyB.LastColumn]; DataTable dtPyB = sheetPyB.ExportDataTable(rangePyB, true, true); CellRange rangePyC = sheetPyC.Range[sheetPyC.FirstRow, sheetPyC.FirstColumn, sheetPyC.LastRow, sheetPyC.LastColumn]; DataTable dtPyC = sheetPyC.ExportDataTable(rangePyC, true, true); CellRange rangePyD = sheetPyD.Range[sheetPyD.FirstRow, sheetPyD.FirstColumn, sheetPyD.LastRow, sheetPyD.LastColumn]; DataTable dtPyD = sheetPyD.ExportDataTable(rangePyD, true, true); int len = dtPxA.Columns.Count; string[] cellValuePxA = new string[len]; string[] cellValuePxB = new string[len]; string[] cellValuePxC = new string[len]; string[] cellValuePxD = new string[len]; string[] cellValuePyA = new string[len]; string[] cellValuePyB = new string[len]; string[] cellValuePyC = new string[len]; string[] cellValuePyD = new string[len]; chartPredictCurveWater.Series[0].Points.Clear(); chartPredictCurveWater.Series[1].Points.Clear(); chartPredictCurveWater.Series[2].Points.Clear(); chartPredictCurveWater.Series[3].Points.Clear(); chartPredictCurveOrganic.Series[0].Points.Clear(); chartPredictCurveOrganic.Series[1].Points.Clear(); chartPredictCurveOrganic.Series[2].Points.Clear(); chartPredictCurveOrganic.Series[3].Points.Clear(); for (int i = 0; i <= len - 1; i++) { cellValuePxA[i] = (string)dtPxA.Rows[0][i]; chartPredictCurveWater.Series[0].Points.AddXY(i, cellValuePxA[i]); cellValuePxB[i] = (string)dtPxB.Rows[0][i]; chartPredictCurveWater.Series[1].Points.AddXY(i, cellValuePxB[i]); cellValuePxC[i] = (string)dtPxC.Rows[0][i]; chartPredictCurveWater.Series[2].Points.AddXY(i, cellValuePxC[i]); cellValuePxD[i] = (string)dtPxD.Rows[0][i]; chartPredictCurveWater.Series[3].Points.AddXY(i, cellValuePxD[i]); cellValuePyA[i] = (string)dtPyA.Rows[0][i]; chartPredictCurveOrganic.Series[0].Points.AddXY(i, cellValuePyA[i]); cellValuePyB[i] = (string)dtPyB.Rows[0][i]; chartPredictCurveOrganic.Series[1].Points.AddXY(i, cellValuePyB[i]); cellValuePyC[i] = (string)dtPyC.Rows[0][i]; chartPredictCurveOrganic.Series[2].Points.AddXY(i, cellValuePyC[i]); cellValuePyD[i] = (string)dtPyD.Rows[0][i]; chartPredictCurveOrganic.Series[3].Points.AddXY(i, cellValuePyD[i]); } }