From bc128a354f0ebc9f714dc1ef958747bb15ec227b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=90=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=D0=BD?= Date: Wed, 1 Nov 2023 19:53:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=D1=8E=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinFormsProject/WinFormsLibrary/CircleDiagram.cs | 4 ++-- .../SupportClasses/DataCircleDiagram.cs | 4 +--- .../SupportClasses/SimpleCircleDiagram.cs | 2 +- WinFormsProject/WinFormsProject/Form2.cs | 11 ++++++----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/WinFormsProject/WinFormsLibrary/CircleDiagram.cs b/WinFormsProject/WinFormsLibrary/CircleDiagram.cs index c3b1675..e515ef6 100644 --- a/WinFormsProject/WinFormsLibrary/CircleDiagram.cs +++ b/WinFormsProject/WinFormsLibrary/CircleDiagram.cs @@ -66,7 +66,7 @@ namespace WinFormsLibrary foreach (var data in simpleCircleDiagram.DataList) { - seriesColl.Add(data.NameSeries, data.NameData, data.Data); + seriesColl.Add(data.NameSeries, simpleCircleDiagram.NameData ,data.Data); } ChartLegend legend = chart.Legend; @@ -82,7 +82,7 @@ namespace WinFormsLibrary { foreach (var _data in data) { - if (string.IsNullOrEmpty(_data.NameData.ToString()) || string.IsNullOrEmpty(_data.Data.ToString())) + if (string.IsNullOrEmpty(_data.NameSeries) || string.IsNullOrEmpty(_data.Data.ToString())) { return false; } diff --git a/WinFormsProject/WinFormsLibrary/SupportClasses/DataCircleDiagram.cs b/WinFormsProject/WinFormsLibrary/SupportClasses/DataCircleDiagram.cs index a3eb2a7..b8bc4b9 100644 --- a/WinFormsProject/WinFormsLibrary/SupportClasses/DataCircleDiagram.cs +++ b/WinFormsProject/WinFormsLibrary/SupportClasses/DataCircleDiagram.cs @@ -9,13 +9,11 @@ namespace WinFormsLibrary.SupportClasses public class DataCircleDiagram { public string NameSeries { get; set; } = string.Empty; - public string[] NameData { get; set; } public double[] Data { get; set; } - public DataCircleDiagram(string nameSeries, string[] nameData, double[] data) + public DataCircleDiagram(string nameSeries, double[] data) { NameSeries = nameSeries; - NameData = nameData; Data = data; } } diff --git a/WinFormsProject/WinFormsLibrary/SupportClasses/SimpleCircleDiagram.cs b/WinFormsProject/WinFormsLibrary/SupportClasses/SimpleCircleDiagram.cs index 26bc56b..39c19a9 100644 --- a/WinFormsProject/WinFormsLibrary/SupportClasses/SimpleCircleDiagram.cs +++ b/WinFormsProject/WinFormsLibrary/SupportClasses/SimpleCircleDiagram.cs @@ -14,7 +14,7 @@ namespace WinFormsLibrary.SupportClasses public List DataList { get; set; } = new(); public string FilePath { get; set; } = string.Empty; public EnumAreaLegend AreaLegend { get; set; } - + public string[] NameData { get; set; } public SimpleCircleDiagram(string filePath, string fileHeader, string circleDiagramName, EnumAreaLegend areaLegend, List dataList) { FilePath = filePath; diff --git a/WinFormsProject/WinFormsProject/Form2.cs b/WinFormsProject/WinFormsProject/Form2.cs index 68f58de..c7de8a5 100644 --- a/WinFormsProject/WinFormsProject/Form2.cs +++ b/WinFormsProject/WinFormsProject/Form2.cs @@ -83,9 +83,9 @@ namespace WinFormsProject List data = new List { - new Student { Group = "ПИбд-32", Faculty = "ФИСТ", Course = 3, Name = "Васильев" }, - new Student { Group = "РТбд-11", Faculty = "РТФ", Course = 1, Name = "Иванов" }, - new Student { Group = "ЛМККбд-41", Faculty = "ГФ", Course = 4, Name = "Смирнова" } + new Student { Group = "ПИбд-32", Faculty = "ФИСТ", Course = 3, Name = "Исмаилов" }, + new Student { Group = "РТбд-11", Faculty = "РТФ", Course = 1, Name = "Чубриков" }, + new Student { Group = "ЛМККбд-41", Faculty = "ГФ", Course = 4, Name = "Летунова" } }; using var dialog = new SaveFileDialog @@ -119,14 +119,15 @@ namespace WinFormsProject { try { - string[] month = { "Январь", "Февраль", "Март" }; double[] profit1 = { 300, 440, 270 }; double[] profit2 = { 500, 620, 310 }; double[] profit3 = { 420, 189, 430 }; SimpleCircleDiagram simpleCircleDiagram = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List { - new DataCircleDiagram("Компания 1", month, profit1), new DataCircleDiagram("Компания 2", month, profit2), new DataCircleDiagram("Компания 3", month, profit3), + new DataCircleDiagram("Компания 1", profit1), new DataCircleDiagram("Компания 2", profit2), new DataCircleDiagram("Компания 3", profit3), }); + simpleCircleDiagram.NameData = new string[] { "Январь", "Февраль", "Март" }; + circleDiagram.AddCircleDiagram(simpleCircleDiagram); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);