const canvas = new CanvasRenderService( 1300, 600, (chartJS) => { chartJS.plugins.register({ beforeDraw: (chartInstance) => { const { ctx } = chartInstance.chart; ctx.fillStyle = '#292929' ctx.fillRect(0, 0, chartInstance.chart.width, chartInstance.chart.height); } }); } ); const dates = []; const pings = []; const data = this.bot.ping.get(message.guild.shard.id); if (!data) return message.reply(`No Stats collected yet.`); for (const item of data) { dates.push(item.date); pings.push(item.ping); } const config = { type: 'line', data: { labels: dates, datasets: [ { label: 'Shard\'s Ping', data: pings, backgroundColor: '#4753ff', borderColor: '#4753ff', fill: false } ] }, options: { legend: { labels: { fontColor: "#ffffff", fontSize: 18 } }, scales: { xAxes: [{ gridLines: { color: "#4a4a4a" }, ticks: { fontColor: "#ffffff", fontSize: 18 } }], yAxes: [{ gridLines: { color: "#4a4a4a" }, ticks: { fontColor: "#ffffff", fontSize: 18 } }] } } } const image = await canvas.renderToBuffer(config);