Merge branch 'main' into element-proxy

# Conflicts:
#	QuestPDF/Drawing/PdfCanvas.cs
#	QuestPDF/QuestPDF.csproj
This commit is contained in:
Marcin Ziąbek
2021-11-19 00:46:46 +01:00
12 changed files with 384 additions and 57 deletions
+62
View File
@@ -0,0 +1,62 @@
using NUnit.Framework;
using QuestPDF.Examples.Engine;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
using Microcharts;
using SkiaSharp;
namespace QuestPDF.Examples
{
public class ChartExample
{
[Test]
public void MicrochartChart()
{
var entries = new[]
{
new ChartEntry(212)
{
Label = "UWP",
ValueLabel = "112",
Color = SKColor.Parse("#2c3e50")
},
new ChartEntry(248)
{
Label = "Android",
ValueLabel = "648",
Color = SKColor.Parse("#77d065")
},
new ChartEntry(128)
{
Label = "iOS",
ValueLabel = "428",
Color = SKColor.Parse("#b455b6")
},
new ChartEntry(514)
{
Label = "Forms",
ValueLabel = "214",
Color = SKColor.Parse("#3498db")
}
};
RenderingTest
.Create()
.PageSize(300, 300)
.ShowResults()
.Render(container =>
{
container.Extend().Canvas((canvas, size) =>
{
var bar = new BarChart
{
Entries = entries,
IsAnimated = false,
};
bar.Draw(canvas, (int)size.Width, (int)size.Height);
});
});
}
}
}
+7 -6
View File
@@ -87,23 +87,24 @@ namespace QuestPDF.Examples
{
RenderingTest
.Create()
.PageSize(400, 250)
.PageSize(800, 600)
.ProduceImages()
.ShowResults()
.Render(container =>
{
container
.Padding(20)
.Box()
.Border(1)
.Background(Colors.Grey.Lighten3)
.Background(Colors.Grey.Lighten4)
.Inlined(inlined =>
{
inlined.VerticalSpacing(50);
inlined.HorizontalSpacing(20);
inlined.AlignSpaceAround();
inlined.BaselineTop();
inlined.HorizontalSpacing(25);
inlined.AlignRight();
inlined.BaselineMiddle();
foreach (var _ in Enumerable.Range(0, 20))
foreach (var _ in Enumerable.Range(0, 100))
inlined.Item().Element(RandomBlock);
});
});
@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="microcharts" Version="0.9.5.9" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />