Aller au contenu
Version: v1.4
Sur cette page

charts()

Ce contenu n’est pas encore disponible dans votre langue.

This function is used to generate a chart of the top users in a guild.

Parameter Type Required Description
message Message ✅ The message object.
options ChartOptions ❌ The options for the chart.
  • { attachment: Buffer, name: string } - A PNG image named chart.png.

Image

Bar and line charts are 950×526 and the other types are 950×950. An empty leaderboard draws an empty chart.

  • new Error() - if the guild is not in the client’s cache, or type is not one of the types below.
const { charts } = require("simply-xp");
charts(message, { type: "bar" })
.then((chart) => message.reply({ files: [chart] })) // Send the chart
.catch((err) => console.log(err)); // Returns the error

Options Type Required Default Description
position number ❌ 5 Number of users needed to be in the chart
background Hex Code ❌ #2F3136 Background color of the chart. The text turns dark on light backgrounds.
type Chart Type ❌ bar Any one from these 'bar' (or) 'line' (or) 'radar' (or) 'doughnut' (or) 'pie' (or) 'polarArea'