Page 1 of 1

Clipped chart labels

Posted: Wed May 31, 2023 1:19 pm
by tijmen
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.

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);
            }
        }
    }
    

Re: Clipped chart labels

Posted: Wed May 31, 2023 2:37 pm
by Max Shamanov
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: Clipped chart labels

Posted: Fri Jun 02, 2023 12:48 pm
by Max Shamanov
Hello,

Please try to load font that you are using in your report to StiFontCollection.
You can use the following code:

Code: Select all

Stimulsoft.Base.StiFontCollection.AddFontFile(FontFile)
If the issue still persist please send us a sample project that reproduce the issue.

Thank you.

Re: Clipped chart labels

Posted: Mon Jun 05, 2023 7:04 am
by tijmen
Thanks for the reply. I've added the following line:

Code: Select all

StiFontCollection.AddFontFile(@"Roboto-Regular.ttf");
The font family can be downloaded here: https://fonts.google.com/specimen/Roboto (version 2.137 2017).

This does not make a difference, however. The issue doesn't seem font-related, clipping also occurs with other fonts.

Re: Clipped chart labels

Posted: Tue Jun 06, 2023 1:28 pm
by Max Shamanov
Hello,

Could you please send us a sample project that reproduces the issue?

Thank you.

Re: Clipped chart labels

Posted: Fri Jun 09, 2023 7:21 am
by tijmen
Max Shamanov wrote: Tue Jun 06, 2023 1:28 pm Hello,

Could you please send us a sample project that reproduces the issue?

Thank you.
Here you go.

Re: Clipped chart labels

Posted: Fri Jun 09, 2023 10:22 am
by Max Shamanov
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
#11593

Re: Clipped chart labels

Posted: Mon Aug 07, 2023 12:13 pm
by tijmen
Hi Max,

Do you have an update on this issue?

Re: Clipped chart labels

Posted: Mon Aug 07, 2023 9:00 pm
by Max Shamanov
Hello,

We are still working on the problem. We will let you know when the solution is available.

Thank you.

Re: Clipped chart labels

Posted: Mon Aug 28, 2023 6:47 am
by Max Shamanov
Hello,

The issue is fixed.
The fix will be available in the next release build 2023.3.4.

Thank you.