Skip to content

renderToBufferSync is undefined #55

Closed
@daveteu

Description

const chartJsFactory = () => {
    const Chart = require('chart.js');
    require('chartjs-plugin-datalabels');
    delete require.cache[require.resolve('chart.js')];
    delete require.cache[require.resolve('chartjs-plugin-datalabels')];
    return Chart;
}

 const canvasRenderService = new CanvasRenderService(1200, 800, (ChartJS) => {


            ChartJS.defaults.global.animation = false;
            ChartJS.defaults.global.responsive = false;
            ChartJS.defaults.global.defaultFontFamily = 'NUNITO';


        }, 'SVG', chartJsFactory);
        canvasRenderService.registerFont('./fonts/NunitoSans-Regular.ttf', { family: 'NUNITO' })
const stream = canvasRenderService.renderToBufferSync(chartOptions,'image/svg+xml')

res.write(stream);
res.end();

While trying to render a SVG, stream is undefined. Already installed imagemagik as documented. I am able to render image/png effortlessly.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions