chartsVersion: v1.4
On this page
charts()
This function is used to generate a chart of the top users in a guild.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| message | Message | ✅ | The message object. |
| options | ChartOptions | ❌ | The options for the chart. |
Returns
Section titled “Returns”{ attachment: Buffer, name: string }- A PNG image namedchart.png.

Bar and line charts are 950×526 and the other types are 950×950. An empty leaderboard draws an empty chart.
Throws
Section titled “Throws”new Error()- if the guild is not in the client’s cache, ortypeis not one of the types below.
[JS] Example
Section titled “[JS] Example”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 errorChart Options
Section titled “Chart Options”| 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' |