Clipped chart labels

Stimulsoft Reports.NET discussion
Post Reply
tijmen
Posts: 6
Joined: Wed Jan 11, 2023 2:28 pm

Clipped chart labels

Post 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);
            }
        }
    }
    
Attachments
Report.xml
(384.94 KiB) Downloaded 130 times
Output.pdf
(11.57 KiB) Downloaded 137 times
Data.xml
(184.44 KiB) Downloaded 121 times
stimulsoft.png
stimulsoft.png (145.61 KiB) Viewed 4013 times
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post by Max Shamanov »

Hello,

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

Thank you.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post 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.
tijmen
Posts: 6
Joined: Wed Jan 11, 2023 2:28 pm

Re: Clipped chart labels

Post 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.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post by Max Shamanov »

Hello,

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

Thank you.
tijmen
Posts: 6
Joined: Wed Jan 11, 2023 2:28 pm

Re: Clipped chart labels

Post 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.
Attachments
StimulsoftRepro.zip
(188.61 KiB) Downloaded 124 times
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post by Max Shamanov »

Hello,

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

Thank you.
#11593
tijmen
Posts: 6
Joined: Wed Jan 11, 2023 2:28 pm

Re: Clipped chart labels

Post by tijmen »

Hi Max,

Do you have an update on this issue?
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post by Max Shamanov »

Hello,

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

Thank you.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Clipped chart labels

Post by Max Shamanov »

Hello,

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

Thank you.
Post Reply