Obsidian Charts plugin - Chart size problem with PDF export

Things I have tried

https://charts.phibr0.de/ (Obsidian Charts Documentation site)
Chart.js | Chart.js (chart.js site)

I visited the above sites but I can’t find any solution.

What I’m trying to do

With the help of Obsidian Charts plug-in, there is no problem with charts within obsidian itself.
But, when I export those charts to pdf file, the chart size is too big to fit into the width of A4 size.

test:: First Test
mark:: 6

const data = dv.current()

const chartData = {
    type: 'bar',
    data: {
        labels: [data.test],
        datasets: [{
            label: 'Grades',
            data: [data.mark],
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)'
            ],
            borderColor: [
                'rgba(255, 99, 132, 1)'
            ],
            borderWidth: 6
        }]
    }
}

window.renderChart(chartData, this.container);

Screen-2023-02-25_01-35-15
Inside Obsidian

Clipboard 1
pdf output

You can see the difference between inside obsidian and pdf output.
Problem 1 : With pdf, the chart size is too big to fit into the A4.
Problem 2 : With pdf exported charts, the y-axis value(5.5?) is not matched with the input value(6)

I’d like to know how I can adjust the size of charts when I export them to pdf.

Have you tried the width modifier? See https://charts.phibr0.de/Modifiers

I’ve not tried it myself, as I don’t export to PDF. Another option would be to vary the export method, like possibly to use print to PDF if that’s an option in your environment.

Further down in the link above, there is also some stuff related to changing the axis which might solve your other issue.

Thank you again, holroy.
I tried but no success.

From my trial and error, I guess that this is related with some css thing.
But don’t know how I can handle the css.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.