Clipped chart labels
Posted: Wed May 31, 2023 1:19 pm
We have a few charts where the labels are clipped. Is there a way to prevent this behavior? This is only visible in the PDF that is generated through the .NET reports library, not when previewing with the Stimulsoft Designer. We use Stimulsoft.Reports.Web.NetCore 2023.2.3.
See attachments for all input and output files. Below is a small code snippet that is used to reproduce this case.
See attachments for all input and output files. Below is a small code snippet that is used to reproduce this case.
Code: Select all
static async Task Main(string[] args)
{
Console.WriteLine(StiVersion.Version);
Console.WriteLine(StiVersion.VersionInfo);
await CreateReport();
Console.WriteLine("Done!");
}
private static async Task CreateReport()
{
StiLicense.Key = _licenseKey;
StiOptions.Export.Pdf.CreatorString = "Stimulsoft";
var template = await File.ReadAllBytesAsync("Report.xml");
var data = XDocument.Parse(await File.ReadAllTextAsync("Data.xml"));
var report = new StiReport();
report.Load(template);
LoadData(report, data.Root);
report.CalculationMode = StiCalculationMode.Interpretation;
await report.RenderAsync();
using var stream = new MemoryStream();
await report.ExportDocumentAsync(StiExportFormat.Pdf, stream, new StiPdfExportSettings
{
ImageCompressionMethod = StiPdfImageCompressionMethod.Flate,
ImageResolutionMode = StiImageResolutionMode.Auto
});
stream.Position = 0;
await using var fileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.Write);
stream.WriteTo(fileStream);
}
private static void LoadData(StiReport report, XElement xmlData)
{
foreach (StiDataSource reportDataSource in report.DataSources)
{
if (reportDataSource is StiVirtualSource)
{
continue;
}
reportDataSource.Dictionary.Databases.Clear();
if (xmlData != null)
{
report.RegData(reportDataSource.Name, xmlData);
}
}
}