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);