|
@@ -1,11 +1,14 @@
|
|
|
|
|
+using System;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
using NUnit.Framework;
|
|
using NUnit.Framework;
|
|
|
using QuestPDF.Examples.Engine;
|
|
using QuestPDF.Examples.Engine;
|
|
|
using QuestPDF.Fluent;
|
|
using QuestPDF.Fluent;
|
|
|
-using QuestPDF.Helpers;
|
|
|
|
|
using QuestPDF.Infrastructure;
|
|
using QuestPDF.Infrastructure;
|
|
|
using Microcharts;
|
|
using Microcharts;
|
|
|
|
|
+using ScottPlot;
|
|
|
using SkiaSharp;
|
|
using SkiaSharp;
|
|
|
|
|
+using Colors = QuestPDF.Helpers.Colors;
|
|
|
|
|
+using Orientation = Microcharts.Orientation;
|
|
|
|
|
|
|
|
namespace QuestPDF.Examples
|
|
namespace QuestPDF.Examples
|
|
|
{
|
|
{
|
|
@@ -84,5 +87,36 @@ namespace QuestPDF.Examples
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void ScottPlotChart()
|
|
|
|
|
+ {
|
|
|
|
|
+ RenderingTest
|
|
|
|
|
+ .Create()
|
|
|
|
|
+ .PageSize(400, 300)
|
|
|
|
|
+ .ProduceImages()
|
|
|
|
|
+ .ShowResults()
|
|
|
|
|
+ .Render(container =>
|
|
|
|
|
+ {
|
|
|
|
|
+ container
|
|
|
|
|
+ .Background(Colors.White)
|
|
|
|
|
+ .Padding(25)
|
|
|
|
|
+ .Canvas((canvas, availableSpace) =>
|
|
|
|
|
+ {
|
|
|
|
|
+ var points = Enumerable
|
|
|
|
|
+ .Range(0, 100)
|
|
|
|
|
+ .Select(x => new Coordinates(x, Math.Sin(x / 10f)))
|
|
|
|
|
+ .ToArray();
|
|
|
|
|
+
|
|
|
|
|
+ using var plot = new Plot();
|
|
|
|
|
+ plot.Add.Scatter(points, Color.FromHex("#009688"));
|
|
|
|
|
+
|
|
|
|
|
+ canvas.Save();
|
|
|
|
|
+ canvas.ClipRect(new SKRect(0, 0, availableSpace.Width, availableSpace.Height));
|
|
|
|
|
+ plot.Render(canvas, (int)availableSpace.Width, (int)availableSpace.Height);
|
|
|
|
|
+ canvas.Restore();
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|