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

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> <ItemGroup>
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" /> <PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
<PackageReference Include="ControlsLibraryNet60" 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"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -19,6 +19,9 @@ using System.Windows.Forms;
using System.Windows.Forms.VisualStyles; using System.Windows.Forms.VisualStyles;
using PdfFormsLibrary; using PdfFormsLibrary;
using PdfFormsLibrary.Helpers; using PdfFormsLibrary.Helpers;
using WinFormsLibrary.SupportClasses;
using WinFormsLibrary.SupportClasses.Enums;
using DataBaseImplement.Models;
namespace AppView namespace AppView
{ {
@ -96,10 +99,7 @@ namespace AppView
} }
} }
private void AddProviderItem_Click( private void AddProviderItem_Click(object sender, EventArgs e)
object sender,
EventArgs e
)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormProvider)); var service = Program.ServiceProvider?.GetService(typeof(FormProvider));
if (service is FormProvider form) if (service is FormProvider form)
@ -258,34 +258,28 @@ namespace AppView
Count = (double)group.Count(), Count = (double)group.Count(),
}); });
var resultData = new List<(int, double)>(); List<double> results = new();
List<string> names = new();
foreach (var provider in providersList) 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() SaveFileDialog saveFileDialog = new()
{ {
Filter = "Word Files|*.docx" Filter = "Word Files|*.docx"
}; };
if (saveFileDialog.ShowDialog() == DialogResult.OK) 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 try
{ {
componentDocumentWithChartPieWord.CreateDoc(config); //componentDocumentWithChartPieWord.CreateDoc(config);
circleDiagram.AddCircleDiagram(simpleCircleDiagram);
MessageBox.Show( MessageBox.Show(
"Word-документ успешно сохранен.", "Word-документ успешно сохранен.",
"Успех", "Успех",