You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to render two charts side by side in a PDF using QuestPDF, but I’m running into an issue where the charts appear extremely small compared to the legend. They also don’t seem to occupy the full available space, as shown in the attached screenshot. I’ve included the code that generates this output. Could anyone please help me figure out what I might be missing or how I can ensure the charts utilize all the space provided?
private void ComposePieCharts(IContainer container)
{
container.Column(column =>
{
var titleStyle = TextStyle
.Default
.FontSize(20)
.SemiBold()
.FontColor(Colors.Black);
// Page title
column.Item().Text("Summary").Style(titleStyle);
// --- First Row (2 Charts) ---
column.Item().Row(row =>
{
for (var i = 1; i <= 2; i++)
{
var entries = GenerateDummyEntries();
// Each chart in its own container
row.RelativeItem()
.ExtendHorizontal()
.Border(1)
.Column(chartColumn =>
{
chartColumn.Item()
.Height(300)
.Width(300)
.PaddingLeft(100)
.SkiaSharpCanvas((canvas, size) =>
{
var chart = new DonutChart
{
Entries = entries,
IsAnimated = false,
LabelMode = LabelMode.RightOnly
};
// Slight scaling if you need to reduce label wrapping
var scaledWidth = (int)(size.Width * 0.9);
var scaledHeight = (int)(size.Height * 0.9);
chart.DrawContent(canvas, scaledWidth, scaledHeight);
});
});
}
});
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I’m trying to render two charts side by side in a PDF using QuestPDF, but I’m running into an issue where the charts appear extremely small compared to the legend. They also don’t seem to occupy the full available space, as shown in the attached screenshot. I’ve included the code that generates this output. Could anyone please help me figure out what I might be missing or how I can ensure the charts utilize all the space provided?
Beta Was this translation helpful? Give feedback.
All reactions