Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
boxWidth: 12,
},
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
},
}],
},
},
};
let pr_img = `chart/${si_chart}.png`;
const y_service = new CanvasRenderService(x_width, x_height, (ChartJS) => {
ChartJS.plugins.register({
beforeDraw(y_chart) {
let y_ctx = y_chart.ctx;
y_ctx.fillStyle = '#ffffff';
y_ctx.fillRect(0, 0, x_width, x_height);
},
});
});
let ds_test = y_service.renderToStream(gc_chart)
.pipe(fs.createWriteStream(`./${pr_img}`));
await once(ds_test, 'finish');
return pr_img;
}
(async () => {
const canvasRenderService = new CanvasRenderService(width, height, chartCallback);
const image = await canvasRenderService.renderToBuffer(configuration);
const dataUrl = await canvasRenderService.renderToDataURL(configuration);
const stream = canvasRenderService.renderToStream(configuration);
cb({ "Status": true, "Message": "Graph Generated", "Buffer": await image })
})();
}
(async () => {
const canvasRenderService = new CanvasRenderService(width, height, chartCallback);
const image = await canvasRenderService.renderToBuffer(configuration);
const dataUrl = await canvasRenderService.renderToDataURL(configuration);
const stream = canvasRenderService.renderToStream(configuration);
var Jimp = require("jimp")
Jimp.read(image).then(async imageone => {
Jimp.read("https://i.imgur.com/Ow3ZyN5.png").then(async imagetwo => {
await imagetwo.composite(imageone, 7, 43)
cb({ "Status": true, "Message": "Graph Generated", "Buffer": await imagetwo.getBufferAsync(Jimp.AUTO) })
})
})
})();
}