Работает Диаграмма Артёма

This commit is contained in:
maxnes3 2023-11-02 09:16:50 +04:00
parent 9e96681e74
commit 3df672c516
2 changed files with 14 additions and 19 deletions

View File

@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
<PackageReference Include="ExcelFormsLibrary" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -19,6 +19,9 @@ using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using PdfFormsLibrary;
using PdfFormsLibrary.Helpers;
using WinFormsLibrary.SupportClasses;
using WinFormsLibrary.SupportClasses.Enums;
using DataBaseImplement.Models;
namespace AppView
{
@ -96,10 +99,7 @@ namespace AppView
}
}
private void AddProviderItem_Click(
object sender,
EventArgs e
)
private void AddProviderItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProvider));
if (service is FormProvider form)
@ -258,34 +258,28 @@ namespace AppView
Count = (double)group.Count(),
});
var resultData = new List<(int, double)>();
List<double> results = new();
List<string> names = new();
foreach (var provider in providersList)
{
resultData.Add((DateTime.Now.Year, provider.Count));
results.Add(provider.Count);
names.Add(provider.Type);
}
ComponentDocumentWithChartConfig config = new()
{
ChartTitle = "Количество поставщиков в разрезе типа организации",
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
Header = "Круговая диаграмма",
Data = new()
{
{ "Тип организации", resultData },
},
};
SaveFileDialog saveFileDialog = new()
{
Filter = "Word Files|*.docx"
};
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
config.FilePath = saveFileDialog.FileName;
SimpleCircleDiagram simpleCircleDiagram = new(saveFileDialog.FileName, "Круговая диаграмма", "Количество поставщиков в разрезе типа организации",
EnumAreaLegend.Right, new() { new DataCircleDiagram("Типы организации", results.ToArray()) });
simpleCircleDiagram.NameData = names.ToArray();
try
{
componentDocumentWithChartPieWord.CreateDoc(config);
//componentDocumentWithChartPieWord.CreateDoc(config);
circleDiagram.AddCircleDiagram(simpleCircleDiagram);
MessageBox.Show(
"Word-документ успешно сохранен.",
"Успех",