From 9d557bb4504e3cd76a46d2b4098de0b1ea2ff93b Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Thu, 3 Oct 2024 15:48:44 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KOP_Labs/Library_var_4_lab_1/BigTextExcel.cs | 9 ++- .../Library_var_4_lab_1/ConfigurableTable.cs | 12 ++-- .../DiagramLegendLocation.cs | 16 +++++ .../Library_var_4_lab_1.csproj | 1 + .../LineDiagram.Designer.cs | 36 +++++++++++ KOP_Labs/Library_var_4_lab_1/LineDiagram.cs | 49 ++++++++++++++ .../LineDiagramCreation.cs | 64 +++++++++++++++++++ .../Library_var_4_lab_1/LineDiagramInfo.cs | 27 ++++++++ .../OfficePackage/AbstractSaveToExcel.cs | 46 +++++++++++-- .../OfficePackage/HelperModels/DiagramInfo.cs | 17 +++++ .../OfficePackage/HelperModels/ExcelInfo.cs | 28 ++++---- .../OfficePackage/Implements/SaveToExcel.cs | 62 +++++++++--------- KOP_Labs/TestProj/Form1.Designer.cs | 13 ++++ KOP_Labs/TestProj/Form1.cs | 44 +++++++------ 14 files changed, 345 insertions(+), 79 deletions(-) create mode 100644 KOP_Labs/Library_var_4_lab_1/DiagramLegendLocation.cs create mode 100644 KOP_Labs/Library_var_4_lab_1/LineDiagram.Designer.cs create mode 100644 KOP_Labs/Library_var_4_lab_1/LineDiagram.cs create mode 100644 KOP_Labs/Library_var_4_lab_1/LineDiagramCreation.cs create mode 100644 KOP_Labs/Library_var_4_lab_1/LineDiagramInfo.cs create mode 100644 KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/DiagramInfo.cs diff --git a/KOP_Labs/Library_var_4_lab_1/BigTextExcel.cs b/KOP_Labs/Library_var_4_lab_1/BigTextExcel.cs index a1cc19f..f3cd6f1 100644 --- a/KOP_Labs/Library_var_4_lab_1/BigTextExcel.cs +++ b/KOP_Labs/Library_var_4_lab_1/BigTextExcel.cs @@ -31,8 +31,13 @@ namespace Library_var_4_lab_1 { throw new ArgumentNullException("Не все параметры введены"); } - ExcelInfo info = new ExcelInfo(path, header, text); - saveToExcel.WriteToFileBigText(info); + ExcelInfo info = new ExcelInfo() + { + FileName = path, + Title = header, + Text = text + }; + saveToExcel.WriteToFileBigText(info); } } } diff --git a/KOP_Labs/Library_var_4_lab_1/ConfigurableTable.cs b/KOP_Labs/Library_var_4_lab_1/ConfigurableTable.cs index c2d20aa..d3c3e44 100644 --- a/KOP_Labs/Library_var_4_lab_1/ConfigurableTable.cs +++ b/KOP_Labs/Library_var_4_lab_1/ConfigurableTable.cs @@ -26,21 +26,19 @@ namespace Library_var_4_lab_1 InitializeComponent(); } - public void CreateTable(string path, string header, List mergeParams, List columnWidth, List tableHeadres, List human) + public void CreateTable(string path, string header, List tableHeadres, List human) { if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(header) - || mergeParams == null || mergeParams.Count == 0 - || columnWidth == null || columnWidth.Count == 0 || tableHeadres == null || tableHeadres.Count == 0 || human == null || human.Count == 0) { throw new ArgumentNullException("Не все параметры введены"); } - ExcelInfo info = new ExcelInfo(path, header, new string[0]); - info.mergeParams = mergeParams; - info.columnWidth = columnWidth; + ExcelInfo info = new ExcelInfo(); + info.FileName = path; + info.Title = header; info.tableHeadres = tableHeadres; - info.data = human; + info.TableData = human; saveToExcel.WriteToFileConfigurableTable(info); } } diff --git a/KOP_Labs/Library_var_4_lab_1/DiagramLegendLocation.cs b/KOP_Labs/Library_var_4_lab_1/DiagramLegendLocation.cs new file mode 100644 index 0000000..b368250 --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/DiagramLegendLocation.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Library_var_4_lab_1 +{ + public enum DiagramLegendLocation + { + Right, + Left, + Top, + Bottom + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/Library_var_4_lab_1.csproj b/KOP_Labs/Library_var_4_lab_1/Library_var_4_lab_1.csproj index abce47b..357d224 100644 --- a/KOP_Labs/Library_var_4_lab_1/Library_var_4_lab_1.csproj +++ b/KOP_Labs/Library_var_4_lab_1/Library_var_4_lab_1.csproj @@ -8,6 +8,7 @@ + diff --git a/KOP_Labs/Library_var_4_lab_1/LineDiagram.Designer.cs b/KOP_Labs/Library_var_4_lab_1/LineDiagram.Designer.cs new file mode 100644 index 0000000..fdae2ed --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/LineDiagram.Designer.cs @@ -0,0 +1,36 @@ +namespace Library_var_4_lab_1 +{ + partial class LineDiagram + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/LineDiagram.cs b/KOP_Labs/Library_var_4_lab_1/LineDiagram.cs new file mode 100644 index 0000000..9e2c59b --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/LineDiagram.cs @@ -0,0 +1,49 @@ +using Library_var_4_lab_1.OfficePackage.HelperModels; +using OfficePackage.HelperModels; +using OfficePackage.Implements; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Library_var_4_lab_1 +{ + public partial class LineDiagram : Component + { + private LineDiagramCreation diagramCreation = new(); + public LineDiagram() + { + InitializeComponent(); + } + + public LineDiagram(IContainer container) + { + container.Add(this); + + InitializeComponent(); + } + + public void CreateDiagram(string path, string header, string diagramHeader, DiagramLegendLocation legendLocation, List<(string, List<(string Name, double Value)>)> data) + { + if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(header) + || string.IsNullOrEmpty(diagramHeader) + || data == null || data.Count == 0) + { + throw new ArgumentNullException(nameof(path)); + } + DiagramInfo info = new() + { + path = path, + header = header, + diagramHeader = diagramHeader, + legendLocation = legendLocation, + data = data + }; + LineDiagramCreation creation = new(); + creation.Create(info); + } + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/LineDiagramCreation.cs b/KOP_Labs/Library_var_4_lab_1/LineDiagramCreation.cs new file mode 100644 index 0000000..e84508f --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/LineDiagramCreation.cs @@ -0,0 +1,64 @@ +using Aspose.Cells; +using Aspose.Cells.Charts; +using Library_var_4_lab_1.OfficePackage.HelperModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Library_var_4_lab_1 +{ + public class LineDiagramCreation + { + Workbook workbook = new Workbook(); + Worksheet worksheet; + public string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + public void Create(DiagramInfo info) + { + worksheet = workbook.Worksheets[0]; + worksheet.Cells["A1"].PutValue(info.header); + int rowIndex = 2; + foreach (var category in info.data[0].values) + { + worksheet.Cells[$"ZA{rowIndex}"].PutValue(category.Item1); + rowIndex++; + } + rowIndex = 2; + int columnIndex = 1; + foreach (var column in info.data) + { + worksheet.Cells[$"Z{Alphabet.ElementAt(columnIndex)}1"].PutValue(column.seriesName); + rowIndex = 2; + foreach (var row in column.values) + { + worksheet.Cells[$"Z{Alphabet.ElementAt(columnIndex)}{rowIndex}"].PutValue(row.Value); + rowIndex++; + } + columnIndex++; + } + + int chartIndex = worksheet.Charts.Add(ChartType.Line, 5, 0, 15, 5); + Chart chart = worksheet.Charts[chartIndex]; + chart.SetChartDataRange("ZA1:ZC4", true); + chart.Title.Text = info.diagramHeader; + switch (info.legendLocation) + { + case DiagramLegendLocation.Left: + chart.Legend.Position = LegendPositionType.Left; + break; + case DiagramLegendLocation.Right: + chart.Legend.Position = LegendPositionType.Right; + break; + case DiagramLegendLocation.Top: + chart.Legend.Position = LegendPositionType.Top; + break; + case DiagramLegendLocation.Bottom: + chart.Legend.Position = LegendPositionType.Bottom; + break; + } + workbook.Save("C:\\Users\\123\\Desktop\\Lab2_KOP2.xlsx"); + } + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/LineDiagramInfo.cs b/KOP_Labs/Library_var_4_lab_1/LineDiagramInfo.cs new file mode 100644 index 0000000..9fbd633 --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/LineDiagramInfo.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Library_var_4_lab_1 +{ + public class LineDiagramInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public string DiagramTitle { get; set; } = string.Empty; + public DiagramLegendLocation LegendLocation { get; set; } = DiagramLegendLocation.Right; + public List>> Data { get; set; } = new(); + + public void CheckFields() + { + if (string.IsNullOrEmpty(FileName)) + throw new ArgumentNullException(nameof(FileName), "File path and name cannot be null or empty."); + if (string.IsNullOrEmpty(Title)) + throw new ArgumentNullException(nameof(Title), "Title cannot be null or empty."); + if (Data == null || !Data.Any()) + throw new ArgumentNullException(nameof(Data), "DiagramData cannot be null or empty."); + } + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/OfficePackage/AbstractSaveToExcel.cs b/KOP_Labs/Library_var_4_lab_1/OfficePackage/AbstractSaveToExcel.cs index 13f21d5..baae617 100644 --- a/KOP_Labs/Library_var_4_lab_1/OfficePackage/AbstractSaveToExcel.cs +++ b/KOP_Labs/Library_var_4_lab_1/OfficePackage/AbstractSaveToExcel.cs @@ -1,4 +1,5 @@ -using DocumentFormat.OpenXml.Vml; +using DocumentFormat.OpenXml.Drawing.Charts; +using DocumentFormat.OpenXml.Vml; using DocumentFormat.OpenXml.Wordprocessing; using OfficePackage.HelperEnums; using OfficePackage.HelperModels; @@ -12,15 +13,16 @@ namespace OfficePackage { public abstract class AbstractSaveToExcel { - public List properties = new List(); public string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + public List properties = new List(); /// /// Создание отчета /// /// public void WriteToFileBigText(ExcelInfo info) { - OpenExcel(info); + OpenExcel(info); InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "A", @@ -40,7 +42,7 @@ namespace OfficePackage }); rowIndex++; } - SaveExcel(info); + SaveExcel(info); } public void WriteToFileConfigurableTable(ExcelInfo info) @@ -81,12 +83,28 @@ namespace OfficePackage } colIndex++; } - foreach (var excelParam in info.mergeParams) + colIndex = 0; + ExcelMergeParameters mergeParams = new ExcelMergeParameters(); + foreach (var column in info.tableHeadres) { - MergeCells(excelParam); + if (column.Nodes.Count == 0) + { + mergeParams.colIndex = colIndex; + mergeParams.isHorisontel = false; + mergeParams.count = 1; + MergeCells(mergeParams); + } + if (column.Nodes.Count > 0) + { + mergeParams.colIndex = colIndex; + mergeParams.isHorisontel = true; + mergeParams.count = column.Nodes.Count; + MergeCells(mergeParams); + } + colIndex++; } int rowIndex = 4; - foreach (var obj in info.data) + foreach (var obj in info.TableData) { if (obj == null) continue; for (int i = 0; i < properties.Count; i++) @@ -110,6 +128,18 @@ namespace OfficePackage } SaveExcel(info); } + + public void CreateDiagram(ExcelInfo info) + { + OpenExcel(info); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 1, + Text = info.Title, + StyleInfo = ExcelStyleInfoType.Title + }); + } /// /// Создание excel-файла /// @@ -126,6 +156,8 @@ namespace OfficePackage /// /// protected abstract void MergeCells(ExcelMergeParameters excelParams); + + protected abstract void CreateLineDiagram(ExcelInfo info); /// /// Сохранение файла /// diff --git a/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/DiagramInfo.cs b/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/DiagramInfo.cs new file mode 100644 index 0000000..c1e9d39 --- /dev/null +++ b/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/DiagramInfo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Library_var_4_lab_1.OfficePackage.HelperModels +{ + public class DiagramInfo + { + public string path { get; set; } = string.Empty; + public string header { get; set; } = string.Empty; + public string diagramHeader { get; set; } = string.Empty; + public DiagramLegendLocation legendLocation { get; set; } = DiagramLegendLocation.Right; + public List<(string seriesName, List<(string Name, double Value)> values)> data { get; set; } = new(); + } +} diff --git a/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/ExcelInfo.cs b/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/ExcelInfo.cs index 489ec31..cf41dbf 100644 --- a/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/ExcelInfo.cs +++ b/KOP_Labs/Library_var_4_lab_1/OfficePackage/HelperModels/ExcelInfo.cs @@ -1,4 +1,5 @@ -using System; +using Library_var_4_lab_1; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,23 +7,26 @@ using System.Threading.Tasks; namespace OfficePackage.HelperModels { - public class ExcelInfo + public class ExcelInfo { public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; public string[]? Text { get; set; } - public List mergeParams { get; set; } - public List columnWidth { get; set; } public List tableHeadres { get; set; } - public List data { get; set; } + public List TableData { get; set; } + public string DiagramTitle { get; set; } = string.Empty; + public DiagramLegendLocation LegendLocation { get; set; } = DiagramLegendLocation.Right; + public List>> DiagramData { get; set; } = new(); - public ExcelInfo(string fileName, string title, string[] text ) - { - FileName = fileName; - Title = title; - Text = text; - } - + public void CheckFields() + { + if (string.IsNullOrEmpty(FileName)) + throw new ArgumentNullException(nameof(FileName), "File path and name cannot be null or empty."); + if (string.IsNullOrEmpty(Title)) + throw new ArgumentNullException(nameof(Title), "Title cannot be null or empty."); + if (DiagramData == null || !DiagramData.Any()) + throw new ArgumentNullException(nameof(DiagramData), "DiagramData cannot be null or empty."); + } } } diff --git a/KOP_Labs/Library_var_4_lab_1/OfficePackage/Implements/SaveToExcel.cs b/KOP_Labs/Library_var_4_lab_1/OfficePackage/Implements/SaveToExcel.cs index 24021c0..3ce7946 100644 --- a/KOP_Labs/Library_var_4_lab_1/OfficePackage/Implements/SaveToExcel.cs +++ b/KOP_Labs/Library_var_4_lab_1/OfficePackage/Implements/SaveToExcel.cs @@ -12,6 +12,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Font = DocumentFormat.OpenXml.Spreadsheet.Font; +using DocumentFormat.OpenXml.Drawing.Charts; +using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing; +using Text = DocumentFormat.OpenXml.Spreadsheet.Text; namespace OfficePackage.Implements { @@ -132,7 +135,7 @@ namespace OfficePackage.Implements { Vertical = VerticalAlignmentValues.Center, WrapText = false, - Horizontal = HorizontalAlignmentValues.Left + Horizontal = HorizontalAlignmentValues.Center }, ApplyFont = true }; @@ -213,9 +216,9 @@ namespace OfficePackage.Implements // Создаем книгу (в ней хранятся листы) var workbookpart = _spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); - CreateStyles(workbookpart); - // Получаем/создаем хранилище текстов для книги - _shareStringPart = + CreateStyles(workbookpart); + // Получаем/создаем хранилище текстов для книги + _shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType().Any() ? _spreadsheetDocument.WorkbookPart.GetPartsOfType().First() @@ -229,12 +232,21 @@ namespace OfficePackage.Implements // Создаем лист в книгу var worksheetPart = workbookpart.AddNewPart(); worksheetPart.Worksheet = new Worksheet(); - Columns columns = new Columns(); - for (int i = 0; i < info.columnWidth.Count; i++) - { - columns.Append(new Column() { Min = (UInt32)i + 1, Max = (UInt32)i + 1, Width = info.columnWidth[i], CustomWidth = true }); + if (info.tableHeadres != null) + { + Columns columns = new Columns(); + for (int i = 0; i < info.tableHeadres.Count; i++) + { + if (info.tableHeadres[i].Nodes.Count == 0) + columns.Append(new Column() { Min = (UInt32)i + 1, Max = (UInt32)i + 1, Width = Convert.ToInt32(info.tableHeadres[i].Name), CustomWidth = true }); + else + for (int j = 0; j < info.tableHeadres[i].Nodes.Count; j++) + { + columns.Append(new Column() { Min = (UInt32)i + 1 + (UInt32)j, Max = (UInt32)i + 1 + (UInt32)j, Width = Convert.ToInt32(info.tableHeadres[i].Nodes[j].Name), CustomWidth = true }); + } + } + worksheetPart.Worksheet.AppendChild(columns); } - worksheetPart.Worksheet.AppendChild(columns); worksheetPart.Worksheet.AppendChild(new SheetData()); // Добавляем лист в книгу var sheets = @@ -246,7 +258,6 @@ namespace OfficePackage.Implements Name = "Лист" }; sheets.Append(sheet); - _worksheet = worksheetPart.Worksheet; } @@ -342,27 +353,7 @@ namespace OfficePackage.Implements _worksheet.Elements().First()); } } - MergeCell mergeCell = new MergeCell(); - // foreach (var excelParam in excelParams) - // { - // if (excelParam.ColumnFromName == null) - // { - // mergeCell = new MergeCell() - // { - // Reference = new StringValue(excelParam.Merge) - // }; - // mergeCells.Append(mergeCell); - // } - - // if (excelParam.CellFromName == string.Empty) - // { - // mergeCell = new MergeCell() - // { - // Reference = new StringValue(excelParam.MergeColumns) - // }; - // } - //} - + MergeCell mergeCell = new MergeCell(); if (excelParams.isHorisontel == false) { mergeCell = new MergeCell() @@ -380,6 +371,15 @@ namespace OfficePackage.Implements mergeCells.Append(mergeCell); } } + + protected override void CreateLineDiagram(ExcelInfo info) + { + //LineChart chart = + //foreach (var series in info.DiagramData) + //{ + // chart. + //} + } protected override void SaveExcel(ExcelInfo info) { if (_spreadsheetDocument == null) diff --git a/KOP_Labs/TestProj/Form1.Designer.cs b/KOP_Labs/TestProj/Form1.Designer.cs index f26bfa8..79070e0 100644 --- a/KOP_Labs/TestProj/Form1.Designer.cs +++ b/KOP_Labs/TestProj/Form1.Designer.cs @@ -61,6 +61,7 @@ buttonWriteLinesToExcel = new Button(); configurableTable1 = new Library_var_4_lab_1.ConfigurableTable(components); button1 = new Button(); + button2 = new Button(); SuspendLayout(); // // dropDownList1 @@ -330,11 +331,22 @@ button1.UseVisualStyleBackColor = true; button1.Click += buttonConfigTable_Click; // + // button2 + // + button2.Location = new Point(1134, 428); + button2.Name = "button2"; + button2.Size = new Size(94, 29); + button2.TabIndex = 30; + button2.Text = "button2"; + button2.UseVisualStyleBackColor = true; + button2.Click += buttonDiagramCreate_Click; + // // Form1 // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1350, 549); + Controls.Add(button2); Controls.Add(button1); Controls.Add(buttonWriteLinesToExcel); Controls.Add(richTextBox); @@ -405,5 +417,6 @@ private Button buttonWriteLinesToExcel; private Library_var_4_lab_1.ConfigurableTable configurableTable1; private Button button1; + private Button button2; } } \ No newline at end of file diff --git a/KOP_Labs/TestProj/Form1.cs b/KOP_Labs/TestProj/Form1.cs index 3a23350..9e76fc3 100644 --- a/KOP_Labs/TestProj/Form1.cs +++ b/KOP_Labs/TestProj/Form1.cs @@ -102,40 +102,27 @@ namespace TestProj private void buttonWriteLinesToExcel_Click(object sender, EventArgs e) { - bigTextExcel.WriteToExcel("C:\\Users\\123\\Desktop\\Lab2_KOP1.xlsx", "", richTextBox.Lines); + bigTextExcel.WriteToExcel("C:\\Users\\123\\Desktop\\Lab2_KOP.xlsx", "", richTextBox.Lines); } // 2 private void buttonConfigTable_Click(object sender, EventArgs e) { - List mergeParameters = new(); - mergeParameters.Add(new ExcelMergeParameters() - { - colIndex = 0, - isHorisontel = false - }); - mergeParameters.Add(new ExcelMergeParameters() - { - colIndex = 1, - isHorisontel = true, - count = 2 - }); - List width = new(); - width.Add(20); - width.Add(20); - width.Add(50); List headers = new List(); headers.Add(new TreeNode() { Text = "", - Tag = "Group" + Name = "20", + Tag = "Group", }); TreeNode node1 = new(); node1.Text = ""; + node1.Name = "20"; node1.Tag = "Name"; TreeNode node2 = new(); node2.Text = ""; + node2.Name = "40"; node2.Tag = "SurName"; TreeNode node3 = new(); node3.Text = ""; @@ -146,8 +133,25 @@ namespace TestProj people.Add(new Human() { Group = "-33", Name = "", SurName = "" }); people.Add(new Human() { Group = "-33", Name = "", SurName = "" }); people.Add(new Human() { Group = "-33", Name = "", SurName = "" }); - configurableTable1.CreateTable("C:\\Users\\123\\Desktop\\Lab2_KOP1.xlsx", "", mergeParameters, width, headers, people); - MessageBox.Show(" "); + configurableTable1.CreateTable("C:\\Users\\123\\Desktop\\Lab2_KOP1.xlsx", "", headers, people); + } + + public void buttonDiagramCreate_Click(object sender, EventArgs e) + { + LineDiagram lineDiagramCreation = new(); + List<(string seriesName, List<(string Name, double Value)> values)> data = new(); + List<(string Name, double Value)> values = new(); + values.Add(("1", 30)); + values.Add(("2", 40)); + values.Add(("3", 60)); + data.Add(("1", values)); + values = new(); + values.Add(("1", 60)); + values.Add(("2", 40)); + values.Add(("3", 30)); + data.Add(("2", values)); + + lineDiagramCreation.CreateDiagram("C:\\Users\\123\\Desktop\\Lab2_KOP1.xlsx", "", "Diagram", DiagramLegendLocation.Right, data); } } } \ No newline at end of file