Сдана

This commit is contained in:
Ismailov_Rovshan 2023-11-01 19:53:25 +04:00
parent caca564260
commit 96234cb606
4 changed files with 100 additions and 99 deletions

View File

@ -10,14 +10,11 @@ namespace VisualComponentsLib.Components.SupportClasses
{ {
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 DataLineChart(string nameSeries, string[] nameData, double[] data) public DataLineChart(string nameSeries, double[] data)
{ {
NameSeries = nameSeries; NameSeries = nameSeries;
NameData = nameData;
Data = data; Data = data;
} }
} }

View File

@ -16,6 +16,7 @@ namespace VisualComponentsLib.Components.SupportClasses
public string LineChartName = string.Empty; public string LineChartName = string.Empty;
public EnumAreaLegend AreaLegend; public EnumAreaLegend AreaLegend;
public string[] NameData { get; set; }
public List<DataLineChart> DataList = new(); public List<DataLineChart> DataList = new();

View File

@ -57,7 +57,7 @@ namespace VisualComponentsLib.Components
foreach (var data in simpleLineChart.DataList) foreach (var data in simpleLineChart.DataList)
{ {
seriesColl.Add(data.NameSeries, data.NameData, data.Data); seriesColl.Add(data.NameSeries, simpleLineChart.NameData, data.Data);
} }
ChartLegend legend = chart.Legend; ChartLegend legend = chart.Legend;
@ -72,7 +72,7 @@ namespace VisualComponentsLib.Components
{ {
foreach (var _data in data) foreach (var _data in data)
{ {
if (string.IsNullOrEmpty(_data.NameSeries) || 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

@ -107,14 +107,17 @@ namespace WinForms
{ {
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 };
SimpleLineChart lineChart = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List<DataLineChart> { SimpleLineChart lineChart = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List<DataLineChart> {
new DataLineChart("Компания 1", month, profit1), new DataLineChart("Компания 2", month, profit2), new DataLineChart("Компания 3", month, profit3), new DataLineChart("Компания 1", profit1),
new DataLineChart("Компания 2", profit2),
new DataLineChart("Компания 3", profit3),
}); });
lineChart.NameData = new string[] { "Январь", "Февраль", "Март" };
wordLineChart.AddLineChart(lineChart); wordLineChart.AddLineChart(lineChart);
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);