Полностью сделана

This commit is contained in:
Артём Алейкин 2023-11-01 19:53:04 +04:00
parent 4c0882df61
commit bc128a354f
4 changed files with 10 additions and 11 deletions

View File

@ -66,7 +66,7 @@ namespace WinFormsLibrary
foreach (var data in simpleCircleDiagram.DataList) 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; ChartLegend legend = chart.Legend;
@ -82,7 +82,7 @@ namespace WinFormsLibrary
{ {
foreach (var _data in data) 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; return false;
} }

View File

@ -9,13 +9,11 @@ namespace WinFormsLibrary.SupportClasses
public class DataCircleDiagram public class DataCircleDiagram
{ {
public string NameSeries { get; set; } = string.Empty; public string NameSeries { get; set; } = string.Empty;
public string[] NameData { get; set; }
public double[] Data { get; set; } public double[] Data { get; set; }
public DataCircleDiagram(string nameSeries, string[] nameData, double[] data) public DataCircleDiagram(string nameSeries, double[] data)
{ {
NameSeries = nameSeries; NameSeries = nameSeries;
NameData = nameData;
Data = data; Data = data;
} }
} }

View File

@ -14,7 +14,7 @@ namespace WinFormsLibrary.SupportClasses
public List<DataCircleDiagram> DataList { get; set; } = new(); public List<DataCircleDiagram> DataList { get; set; } = new();
public string FilePath { get; set; } = string.Empty; public string FilePath { get; set; } = string.Empty;
public EnumAreaLegend AreaLegend { get; set; } public EnumAreaLegend AreaLegend { get; set; }
public string[] NameData { get; set; }
public SimpleCircleDiagram(string filePath, string fileHeader, string circleDiagramName, EnumAreaLegend areaLegend, List<DataCircleDiagram> dataList) public SimpleCircleDiagram(string filePath, string fileHeader, string circleDiagramName, EnumAreaLegend areaLegend, List<DataCircleDiagram> dataList)
{ {
FilePath = filePath; FilePath = filePath;

View File

@ -83,9 +83,9 @@ namespace WinFormsProject
List<Student> data = new List<Student> List<Student> data = new List<Student>
{ {
new Student { Group = "ПИбд-32", Faculty = "ФИСТ", Course = 3, Name = "Васильев" }, new Student { Group = "ПИбд-32", Faculty = "ФИСТ", Course = 3, Name = "Исмаилов" },
new Student { Group = "РТбд-11", Faculty = "РТФ", Course = 1, Name = "Иванов" }, new Student { Group = "РТбд-11", Faculty = "РТФ", Course = 1, Name = "Чубриков" },
new Student { Group = "ЛМККбд-41", Faculty = "ГФ", Course = 4, Name = "Смирнова" } new Student { Group = "ЛМККбд-41", Faculty = "ГФ", Course = 4, Name = "Летунова" }
}; };
using var dialog = new SaveFileDialog using var dialog = new SaveFileDialog
@ -119,14 +119,15 @@ namespace WinFormsProject
{ {
try try
{ {
string[] month = { "Январь", "Февраль", "Март" };
double[] profit1 = { 300, 440, 270 }; double[] profit1 = { 300, 440, 270 };
double[] profit2 = { 500, 620, 310 }; double[] profit2 = { 500, 620, 310 };
double[] profit3 = { 420, 189, 430 }; double[] profit3 = { 420, 189, 430 };
SimpleCircleDiagram simpleCircleDiagram = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List<DataCircleDiagram> { SimpleCircleDiagram simpleCircleDiagram = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List<DataCircleDiagram> {
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); circleDiagram.AddCircleDiagram(simpleCircleDiagram);
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);