Option reference

Chart title and subtitle

A title says what the chart shows, so the image still makes sense when it lands in an email or a chat with nothing around it.

The title is the title plugin, options.plugins.title. It is off until you set display to true and give it a text. The subtitle is a second plugin, options.plugins.subtitle, with the same options. ChartPNG's theme draws the title at the top left in bold, and the subtitle under it in the quieter text colour.

The numbers in the images are sample data. Each image is what the URL under it returns.

A title

Set display to true and give the text. Without display the title is not drawn.

Bar chart of signups per week with the title Signups per week above it
Open in the editor

The part of the config that matters

{
  "options": {
    "plugins": {
      "title": {
        "display": true,
        "text": "Signups per week"
      }
    }
  }
}

The full URL

https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%5D%7D%2C%22options%22%3A%7B%22plugins%22%3A%7B%22title%22%3A%7B%22display%22%3Atrue%2C%22text%22%3A%22Signups%20per%20week%22%7D%7D%7D%7D

A title and a subtitle

The subtitle is its own plugin, under the title, in a quieter colour.

Bar chart of signups per week with a title and a smaller subtitle under it
Open in the editor

The part of the config that matters

{
  "options": {
    "plugins": {
      "title": {
        "display": true,
        "text": "Signups per week"
      },
      "subtitle": {
        "display": true,
        "text": "Sample data, all channels"
      }
    }
  }
}

The full URL

https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%5D%7D%2C%22options%22%3A%7B%22plugins%22%3A%7B%22title%22%3A%7B%22display%22%3Atrue%2C%22text%22%3A%22Signups%20per%20week%22%7D%2C%22subtitle%22%3A%7B%22display%22%3Atrue%2C%22text%22%3A%22Sample%20data%2C%20all%20channels%22%7D%7D%7D%7D

Two lines

A list of strings is a title on several lines, one string per line.

Bar chart of signups per week with a title on two lines
Open in the editor

The part of the config that matters

{
  "options": {
    "plugins": {
      "title": {
        "text": ["Signups per week", "first half of the year"]
      }
    }
  }
}

The full URL

https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%5D%7D%2C%22options%22%3A%7B%22plugins%22%3A%7B%22title%22%3A%7B%22display%22%3Atrue%2C%22text%22%3A%5B%22Signups%20per%20week%22%2C%22first%20half%20of%20the%20year%22%5D%7D%7D%7D%7D

Position, alignment, size and colour

position is top or bottom, align is start, center or end, and font and color style the text.

Bar chart of signups per week with a large orange title centred below the chart
Open in the editor

The part of the config that matters

{
  "options": {
    "plugins": {
      "title": {
        "position": "bottom",
        "align": "center",
        "color": "#b8430f",
        "font": {
          "size": 22
        }
      }
    }
  }
}

The full URL

https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%5D%7D%2C%22options%22%3A%7B%22plugins%22%3A%7B%22title%22%3A%7B%22display%22%3Atrue%2C%22text%22%3A%22Signups%20per%20week%22%2C%22position%22%3A%22bottom%22%2C%22align%22%3A%22center%22%2C%22color%22%3A%22%23b8430f%22%2C%22font%22%3A%7B%22size%22%3A22%7D%7D%7D%7D%7D

Things to know

More options