1 Workbook workbook = new Workbook();
2 workbook.LoadFromFile(@"F:/datawrite.xlsx");
3 Worksheet sheetPxA = workbook.Worksheets[0];
4 Worksheet sheetPxB = workbook.Worksheets[1];
5 Worksheet sheetPxC = workbook.Worksheets[2];
6 Worksheet sheetPxD = workbook.Worksheets[3];
7 Worksheet sheetPyA = workbook.Worksheets[4];
8 Worksheet sheetPyB = workbook.Worksheets[5];
9 Worksheet sheetPyC = workbook.Worksheets[6];
10 Worksheet sheetPyD = workbook.Worksheets[7];
11
12 CellRange rangePxA = sheetPxA.Range[30, sheetPxA.FirstColumn, 31, 81];
13 DataTable dtPxA = sheetPxA.ExportDataTable(rangePxA, true, true);
14 CellRange rangePxB = sheetPxB.Range[30, sheetPxB.FirstColumn, 31, 81];
15 DataTable dtPxB = sheetPxB.ExportDataTable(rangePxB, true, true);
16 CellRange rangePxC = sheetPxC.Range[30, sheetPxC.FirstColumn, 31, 81];
17 DataTable dtPxC = sheetPxC.ExportDataTable(rangePxC, true, true);
18 CellRange rangePxD = sheetPxD.Range[30, sheetPxD.FirstColumn, 31, 81];
19 DataTable dtPxD = sheetPxD.ExportDataTable(rangePxD, true, true);
20
21 CellRange rangePyA = sheetPyA.Range[30, sheetPyA.FirstColumn, 31, 81];
22 DataTable dtPyA = sheetPyA.ExportDataTable(rangePyA, true, true);
23 CellRange rangePyB = sheetPyB.Range[30, sheetPyB.FirstColumn, 31, 81];
24 DataTable dtPyB = sheetPyB.ExportDataTable(rangePyB, true, true);
25 CellRange rangePyC = sheetPyC.Range[30, sheetPyC.FirstColumn, 31, 81];
26 DataTable dtPyC = sheetPyC.ExportDataTable(rangePyC, true, true);
27
28 int len = dtPxA.Columns.Count;
29 string[] cellValuePxA = new string[len];
30 string[] cellValuePxB = new string[len];
31 string[] cellValuePxC = new string[len];
32 string[] cellValuePxD = new string[len];
33
34 string[] cellValuePyA = new string[len];
35 string[] cellValuePyB = new string[len];
36 string[] cellValuePyC = new string[len];
37
38 chartPredictCurveWater.Series[0].Points.Clear();
39 chartPredictCurveWater.Series[1].Points.Clear();
40 chartPredictCurveWater.Series[2].Points.Clear();
41 chartPredictCurveWater.Series[3].Points.Clear();
42
43 chartPredictCurveOrganic.Series[0].Points.Clear();
44 chartPredictCurveOrganic.Series[1].Points.Clear();
45 chartPredictCurveOrganic.Series[2].Points.Clear();
46
47 for (int i = 0; i <= len - 1; i++)
48 {
49 cellValuePxA[i] = (string)dtPxA.Rows[0][i];
50 chartPredictCurveWater.Series[0].Points.AddXY(i, cellValuePxA[i]);
51 cellValuePxB[i] = (string)dtPxB.Rows[0][i];
52 chartPredictCurveWater.Series[1].Points.AddXY(i, cellValuePxB[i]);
53 cellValuePxC[i] = (string)dtPxC.Rows[0][i];
54 chartPredictCurveWater.Series[2].Points.AddXY(i, cellValuePxC[i]);
55 cellValuePxD[i] = (string)dtPxD.Rows[0][i];
56 chartPredictCurveWater.Series[3].Points.AddXY(i, cellValuePxD[i]);
57
58 cellValuePyA[i] = (string)dtPyA.Rows[0][i];
59 chartPredictCurveOrganic.Series[0].Points.AddXY(i, cellValuePyA[i]);
60 cellValuePyB[i] = (string)dtPyB.Rows[0][i];
61 chartPredictCurveOrganic.Series[1].Points.AddXY(i, cellValuePyB[i]);
62 cellValuePyC[i] = (string)dtPyC.Rows[0][i];
63 chartPredictCurveOrganic.Series[2].Points.AddXY(i, cellValuePyC[i]);
64 }